diff --git a/.github/workflows/audit-check.yml b/.github/workflows/audit-check.yml index 332799198..643387cfc 100644 --- a/.github/workflows/audit-check.yml +++ b/.github/workflows/audit-check.yml @@ -4,6 +4,10 @@ on: branches: - "**" +concurrency: + group: ${{ github.event_name == 'pull_request' && format('{0}-{1}', github.workflow_ref, github.event.pull_request.number) || github.run_id }} + cancel-in-progress: true + jobs: security_audit: runs-on: ubuntu-latest diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index cf1ad22fd..7110562d8 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -10,6 +10,10 @@ on: branches: - "**" +concurrency: + group: ${{ github.event_name == 'pull_request' && format('{0}-{1}', github.workflow_ref, github.event.pull_request.number) || github.run_id }} + cancel-in-progress: true + jobs: tests: name: Unit Tests @@ -20,6 +24,9 @@ jobs: os: [macos-latest, ubuntu-latest, windows-latest] python-version: ["3.8", "3.9", "3.10", "3.11"] + env: + stubtest_args: ${{ matrix.python-version == '3.11' && '--allowlist wheel/stubtest.allowlist.3-11-plus' || ''}} + steps: - uses: actions/checkout@v4 with: @@ -58,7 +65,27 @@ jobs: - name: python mypy run: | - mypy --ignore-missing-imports tests + mypy tests + + - name: python mypy stubtest + shell: bash + run: | + FAILURE=0 + echo "::group::concise" + if ! stubtest ${{ env.stubtest_args }} --allowlist wheel/stubtest.allowlist --concise chia_rs + then + FAILURE=1 + fi + echo "::endgroup::" + + echo "::group::complete" + if ! stubtest ${{ env.stubtest_args }} --allowlist wheel/stubtest.allowlist chia_rs + then + FAILURE=1 + fi + echo "::endgroup::" + + exit ${FAILURE} - name: python black run: | diff --git a/.github/workflows/build-crate.yml b/.github/workflows/build-crate.yml index 7d23470f1..0097e566e 100644 --- a/.github/workflows/build-crate.yml +++ b/.github/workflows/build-crate.yml @@ -10,6 +10,10 @@ on: branches: - "**" +concurrency: + group: ${{ github.event_name == 'pull_request' && format('{0}-{1}', github.workflow_ref, github.event.pull_request.number) || github.run_id }} + cancel-in-progress: true + jobs: build_crate: name: Build crate @@ -28,6 +32,12 @@ jobs: - name: Clippy run: cargo clippy --workspace --all-features --all-targets + - name: Install cargo-machete + run: cargo install cargo-machete + + - name: Unused dependencies + run: cargo machete + - name: Tests (debug) run: cargo test --workspace --all-features diff --git a/.github/workflows/build-npm.yml b/.github/workflows/build-npm.yml index 4679bd3c8..d19b091e6 100644 --- a/.github/workflows/build-npm.yml +++ b/.github/workflows/build-npm.yml @@ -10,6 +10,10 @@ on: branches: - "**" +concurrency: + group: ${{ github.event_name == 'pull_request' && format('{0}-{1}', github.workflow_ref, github.event.pull_request.number) || github.run_id }} + cancel-in-progress: true + jobs: build_npm: name: Build npm diff --git a/.github/workflows/build-riscv64.yml b/.github/workflows/build-riscv64.yml index 4099724be..57708ccf3 100644 --- a/.github/workflows/build-riscv64.yml +++ b/.github/workflows/build-riscv64.yml @@ -10,6 +10,10 @@ on: branches: - "**" +concurrency: + group: ${{ github.event_name == 'pull_request' && format('{0}-{1}', github.workflow_ref, github.event.pull_request.number) || github.run_id }} + cancel-in-progress: true + permissions: id-token: write contents: read diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index f2d95d961..b28001bcb 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -11,8 +11,7 @@ on: - "**" concurrency: - # SHA is added to the end if on `main` to let all main workflows run - group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} + group: ${{ github.event_name == 'pull_request' && format('{0}-{1}', github.workflow_ref, github.event.pull_request.number) || github.run_id }} cancel-in-progress: true permissions: @@ -31,7 +30,7 @@ jobs: matrix: macos runs-on: arm: [macOS, ARM64] - intel: [macos-12] + intel: [macos-13] - name: Ubuntu matrix: ubuntu runs-on: @@ -149,7 +148,7 @@ jobs: - name: Build MacOs with maturin on Python ${{ matrix.python }} if: matrix.os.matrix == 'macos' env: - MACOSX_DEPLOYMENT_TARGET: "11.0" + MACOSX_DEPLOYMENT_TARGET: "13.0" run: | python${{ matrix.python.major-dot-minor }} -m venv venv . venv/bin/activate @@ -190,8 +189,15 @@ jobs: directories: ${{ steps.create-venv.outputs.activate-venv-directories }} - name: Install chia_rs wheel + shell: bash run: | - pip install --no-index --find-links target/wheels/ chia_rs + TMP_DEST=$(mktemp -d) + pip download --no-index --no-deps --only-binary :all: --find-links target/wheels/ --dest "${TMP_DEST}" chia_rs + echo ==== + ls -l "${TMP_DEST}" + echo ==== + pip install "${TMP_DEST}"/* + rm -rf "${TMP_DEST}" - name: Upload artifacts uses: actions/upload-artifact@v4 diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 29387b657..0310583f0 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -10,6 +10,10 @@ on: branches: - "**" +concurrency: + group: ${{ github.event_name == 'pull_request' && format('{0}-{1}', github.workflow_ref, github.event.pull_request.number) || github.run_id }} + cancel-in-progress: true + jobs: prettier: name: Prettier diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f59794fe3..dcaf8c314 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,6 +28,12 @@ repos: entry: cargo clippy --workspace --all-features --all-targets language: system pass_filenames: false + - id: machete + name: machete + description: run cargo machete on the workspace + entry: cargo machete + language: system + pass_filenames: false - id: tests name: run tests description: run cargo test on the workspace diff --git a/Cargo.lock b/Cargo.lock index f9f1f9c33..2cf3864be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -271,16 +271,17 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chia" -version = "0.13.0" +version = "0.14.1" dependencies = [ - "chia-bls 0.13.0", + "chia-bls 0.14.1", "chia-client", "chia-consensus", "chia-datalayer", "chia-protocol", "chia-puzzles", + "chia-sha2", "chia-ssl", - "chia-traits 0.11.0", + "chia-traits 0.14.1", "clvm-traits", "clvm-utils", "clvmr", @@ -304,14 +305,13 @@ dependencies = [ [[package]] name = "chia-bls" -version = "0.13.0" +version = "0.14.1" dependencies = [ - "anyhow", "arbitrary", "blst", - "chia-traits 0.11.0", + "chia-sha2", + "chia-traits 0.14.1", "chia_py_streamable_macro", - "clvmr", "criterion", "hex", "hkdf", @@ -327,17 +327,17 @@ dependencies = [ name = "chia-bls-fuzz" version = "0.13.0" dependencies = [ - "chia-bls 0.13.0", + "chia-bls 0.14.1", "libfuzzer-sys", "pyo3", ] [[package]] name = "chia-client" -version = "0.13.0" +version = "0.14.1" dependencies = [ "chia-protocol", - "chia-traits 0.11.0", + "chia-traits 0.14.1", "futures-util", "thiserror", "tokio", @@ -347,15 +347,15 @@ dependencies = [ [[package]] name = "chia-consensus" -version = "0.13.0" +version = "0.14.1" dependencies = [ - "chia-bls 0.13.0", + "chia-bls 0.14.1", "chia-protocol", "chia-puzzles", - "chia-traits 0.11.0", + "chia-sha2", + "chia-traits 0.14.1", "chia_py_streamable_macro", - "chia_streamable_macro 0.11.0", - "clvm-derive", + "chia_streamable_macro 0.14.1", "clvm-traits", "clvm-utils", "clvmr", @@ -374,7 +374,6 @@ dependencies = [ name = "chia-datalayer" version = "0.1.0" dependencies = [ - "chia-traits 0.11.0", "clvm-utils", "clvmr", "hex-literal", @@ -391,7 +390,8 @@ version = "0.13.0" dependencies = [ "chia-consensus", "chia-protocol", - "chia-traits 0.11.0", + "chia-sha2", + "chia-traits 0.14.1", "clvm-traits", "clvm-utils", "clvmr", @@ -401,13 +401,14 @@ dependencies = [ [[package]] name = "chia-protocol" -version = "0.13.0" +version = "0.14.1" dependencies = [ "arbitrary", - "chia-bls 0.13.0", - "chia-traits 0.11.0", + "chia-bls 0.14.1", + "chia-sha2", + "chia-traits 0.14.1", "chia_py_streamable_macro", - "chia_streamable_macro 0.11.0", + "chia_streamable_macro 0.14.1", "clvm-traits", "clvm-utils", "clvmr", @@ -422,7 +423,8 @@ version = "0.13.0" dependencies = [ "arbitrary", "chia-protocol", - "chia-traits 0.11.0", + "chia-sha2", + "chia-traits 0.14.1", "clvm-traits", "clvmr", "hex", @@ -431,11 +433,12 @@ dependencies = [ [[package]] name = "chia-puzzles" -version = "0.13.0" +version = "0.14.1" dependencies = [ "arbitrary", - "chia-bls 0.13.0", + "chia-bls 0.14.1", "chia-protocol", + "chia-sha2", "clvm-traits", "clvm-utils", "clvmr", @@ -452,7 +455,14 @@ dependencies = [ "clvm-traits", "clvmr", "libfuzzer-sys", - "pyo3", +] + +[[package]] +name = "chia-sha2" +version = "0.14.1" +dependencies = [ + "openssl", + "sha2", ] [[package]] @@ -469,20 +479,19 @@ dependencies = [ [[package]] name = "chia-tools" -version = "0.13.0" +version = "0.14.1" dependencies = [ "blocking-threadpool", - "chia-bls 0.13.0", + "chia-bls 0.14.1", "chia-consensus", "chia-protocol", "chia-puzzles", - "chia-traits 0.11.0", + "chia-traits 0.14.1", "clap", "clvm-traits", "clvm-utils", "clvmr", "hex", - "hex-literal", "rusqlite", "zstd", ] @@ -500,17 +509,17 @@ dependencies = [ [[package]] name = "chia-traits" -version = "0.11.0" +version = "0.14.1" dependencies = [ - "chia_streamable_macro 0.11.0", - "clvmr", + "chia-sha2", + "chia_streamable_macro 0.14.1", "pyo3", "thiserror", ] [[package]] name = "chia_py_streamable_macro" -version = "0.13.0" +version = "0.14.1" dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", @@ -520,16 +529,12 @@ dependencies = [ [[package]] name = "chia_rs" -version = "0.13.0" +version = "0.14.1" dependencies = [ - "chia-bls 0.13.0", + "chia-bls 0.14.1", "chia-consensus", "chia-datalayer", "chia-protocol", - "chia-traits 0.11.0", - "chia_py_streamable_macro", - "chia_streamable_macro 0.11.0", - "clvm-traits", "clvm-utils", "clvmr", "hex", @@ -550,9 +555,8 @@ dependencies = [ [[package]] name = "chia_streamable_macro" -version = "0.11.0" +version = "0.14.1" dependencies = [ - "clvmr", "proc-macro-crate 1.3.1", "proc-macro2", "quote", @@ -644,9 +648,9 @@ dependencies = [ [[package]] name = "clvm-traits" -version = "0.13.0" +version = "0.14.1" dependencies = [ - "chia-bls 0.13.0", + "chia-bls 0.14.1", "clvm-derive", "clvmr", "hex", @@ -667,8 +671,9 @@ dependencies = [ [[package]] name = "clvm-utils" -version = "0.13.0" +version = "0.14.1" dependencies = [ + "chia-sha2", "clvm-traits", "clvmr", "hex", @@ -688,9 +693,9 @@ dependencies = [ [[package]] name = "clvmr" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "903233f3bc9392b44a589f0cea46a53a67fedc3afb4b1303f636977074a505c5" +checksum = "ffccd9116f36edbf02dad718a2fece269d05492fb31278423883ef464444bbb6" dependencies = [ "chia-bls 0.10.0", "hex-literal", @@ -1625,9 +1630,9 @@ dependencies = [ [[package]] name = "openssl-src" -version = "300.3.1+3.3.1" +version = "300.3.2+3.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7259953d42a81bf137fbbd73bd30a8e1914d6dce43c2b90ed575783a22608b91" +checksum = "a211a18d945ef7e648cc6e0058f4c548ee46aab922ea203e0d30e966ea23647b" dependencies = [ "cc", ] diff --git a/Cargo.toml b/Cargo.toml index 468b3ce69..52b458fbf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chia" -version = "0.13.0" +version = "0.14.1" edition = "2021" license = "Apache-2.0" description = "A meta-crate that exports all of the Chia crates in the workspace." @@ -59,10 +59,16 @@ chia-protocol = { workspace = true, optional = true } chia-ssl = { workspace = true, optional = true } chia-traits = { workspace = true, optional = true } chia-puzzles = { workspace = true, optional = true } +chia-sha2 = { workspace = true, optional = true } clvm-traits = { workspace = true, optional = true } clvm-utils = { workspace = true, optional = true } clvmr = { workspace = true } +# This is required since clvmr is only added here to provide the openssl feature conditionally. +# In the future we could pass the openssl feature to each of the relevant workspace crates instead. +[package.metadata.cargo-machete] +ignored = ["clvmr"] + [features] default = [ "bls", @@ -73,6 +79,7 @@ default = [ "ssl", "traits", "puzzles", + "sha2", "clvm-traits", "clvm-utils" ] @@ -85,31 +92,33 @@ protocol = ["dep:chia-protocol"] ssl = ["dep:chia-ssl"] traits = ["dep:chia-traits"] puzzles = ["dep:chia-puzzles"] +sha2 = ["dep:chia-sha2"] clvm-traits = ["dep:clvm-traits"] clvm-utils = ["dep:clvm-utils"] -openssl = ["clvmr/openssl"] +openssl = ["chia-sha2/openssl", "clvmr/openssl"] [profile.release] lto = "thin" [workspace.dependencies] -chia_py_streamable_macro = { path = "./crates/chia_py_streamable_macro", version = "0.13.0" } -chia_streamable_macro = { path = "./crates/chia_streamable_macro", version = "0.11.0" } -chia-bls = { path = "./crates/chia-bls", version = "0.13.0" } -chia-client = { path = "./crates/chia-client", version = "0.13.0" } -chia-consensus = { path = "./crates/chia-consensus", version = "0.13.0" } +chia_py_streamable_macro = { path = "./crates/chia_py_streamable_macro", version = "0.14.1" } +chia_streamable_macro = { path = "./crates/chia_streamable_macro", version = "0.14.1" } +chia-bls = { path = "./crates/chia-bls", version = "0.14.1" } +chia-client = { path = "./crates/chia-client", version = "0.14.1" } +chia-consensus = { path = "./crates/chia-consensus", version = "0.14.1" } chia-datalayer = { path = "./crates/chia-datalayer", version = "0.1.0" } -chia-protocol = { path = "./crates/chia-protocol", version = "0.13.0" } +chia-protocol = { path = "./crates/chia-protocol", version = "0.14.1" } chia-ssl = { path = "./crates/chia-ssl", version = "0.11.0" } -chia-traits = { path = "./crates/chia-traits", version = "0.11.0" } -chia-puzzles = { path = "./crates/chia-puzzles", version = "0.13.0" } -clvm-traits = { path = "./crates/clvm-traits", version = "0.13.0" } -clvm-utils = { path = "./crates/clvm-utils", version = "0.13.0" } +chia-traits = { path = "./crates/chia-traits", version = "0.14.1" } +chia-puzzles = { path = "./crates/chia-puzzles", version = "0.14.1" } +chia-sha2 = { path = "./crates/chia-sha2", version = "0.14.1" } +clvm-traits = { path = "./crates/clvm-traits", version = "0.14.1" } +clvm-utils = { path = "./crates/clvm-utils", version = "0.14.1" } clvm-derive = { path = "./crates/clvm-derive", version = "0.13.0" } chia-fuzz = { path = "./crates/chia-consensus/fuzz", version = "0.13.0" } blst = { version = "0.3.12", features = ["portable"] } -clvmr = "0.8.0" +clvmr = "0.9.0" syn = "2.0.75" quote = "1.0.32" proc-macro2 = "1.0.84" @@ -143,6 +152,7 @@ zstd = "0.13.2" blocking-threadpool = "1.0.1" libfuzzer-sys = "0.4" wasm-bindgen = "0.2.93" +openssl = "0.10.66" open = "5.3.0" url = "2.5.2" percent-encoding = "2.3.1" diff --git a/README.md b/README.md index 96f9efe1f..19884df0c 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ To list and run fuzzers: ```bash cargo fuzz list -cargo fuzz run +cargo +nightly fuzz run --jobs=10 ``` ## Bumping Version Number diff --git a/crates/chia-bls/Cargo.toml b/crates/chia-bls/Cargo.toml index e6377d349..16fd564e9 100644 --- a/crates/chia-bls/Cargo.toml +++ b/crates/chia-bls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chia-bls" -version = "0.13.0" +version = "0.14.1" edition = "2021" license = "Apache-2.0" description = "BLS signature, verification and aggregation functions for the Chia blockchain" @@ -17,10 +17,9 @@ arbitrary = ["dep:arbitrary"] [dependencies] chia-traits = { workspace = true } +chia-sha2 = { workspace = true } chia_py_streamable_macro = { workspace = true, optional = true } -anyhow = { workspace = true } sha2 = { workspace = true } -clvmr = { workspace = true } hkdf = { workspace = true } blst = { workspace = true } hex = { workspace = true } diff --git a/crates/chia-bls/src/bls_cache.rs b/crates/chia-bls/src/bls_cache.rs index f375465cc..a059ec825 100644 --- a/crates/chia-bls/src/bls_cache.rs +++ b/crates/chia-bls/src/bls_cache.rs @@ -1,7 +1,7 @@ use std::borrow::Borrow; use std::num::NonZeroUsize; -use clvmr::sha2::Sha256; +use chia_sha2::Sha256; use lru::LruCache; use crate::{aggregate_verify_gt, hash_to_g2}; @@ -83,7 +83,7 @@ impl BlsCache { use pyo3::{ exceptions::PyValueError, pybacked::PyBackedBytes, - types::{PyAnyMethods, PyList}, + types::{PyAnyMethods, PyList, PySequence}, Bound, PyObject, PyResult, }; @@ -137,26 +137,19 @@ impl BlsCache { use pyo3::types::PyBytes; let ret = PyList::empty_bound(py); for (key, value) in &self.cache { - ret.append(( - PyBytes::new_bound(py, key), - PyBytes::new_bound(py, &value.to_bytes()), - ))?; + ret.append((PyBytes::new_bound(py, key), value.clone().into_py(py)))?; } Ok(ret.into()) } #[pyo3(name = "update")] - pub fn py_update(&mut self, other: &Bound<'_, PyList>) -> PyResult<()> { + pub fn py_update(&mut self, other: &Bound<'_, PySequence>) -> PyResult<()> { for item in other.borrow().iter()? { - let (key, value): (Vec, Vec) = item?.extract()?; + let (key, value): (Vec, GTElement) = item?.extract()?; self.cache.put( key.try_into() .map_err(|_| PyValueError::new_err("invalid key"))?, - GTElement::from_bytes( - (&value[..]) - .try_into() - .map_err(|_| PyValueError::new_err("invalid GTElement"))?, - ), + value, ); } Ok(()) diff --git a/crates/chia-bls/src/gtelement.rs b/crates/chia-bls/src/gtelement.rs index 5c42fbd1c..373890c2f 100644 --- a/crates/chia-bls/src/gtelement.rs +++ b/crates/chia-bls/src/gtelement.rs @@ -1,7 +1,13 @@ use blst::*; +use chia_sha2::Sha256; use chia_traits::chia_error::Result; use chia_traits::{read_bytes, Streamable}; -use clvmr::sha2::Sha256; +#[cfg(feature = "py-bindings")] +use pyo3::exceptions::PyNotImplementedError; +#[cfg(feature = "py-bindings")] +use pyo3::prelude::*; +#[cfg(feature = "py-bindings")] +use pyo3::types::PyType; use std::fmt; use std::hash::{Hash, Hasher}; use std::io::Cursor; @@ -112,6 +118,14 @@ impl GTElement { hex::encode(self.to_bytes()) } + #[classmethod] + #[pyo3(name = "from_parent")] + pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: &Self) -> PyResult { + Err(PyNotImplementedError::new_err( + "GTElement does not support from_parent().", + )) + } + #[must_use] pub fn __mul__(&self, rhs: &Self) -> Self { let mut ret = self.clone(); @@ -130,7 +144,6 @@ mod pybindings { use crate::parse_hex::parse_hex_string; use chia_traits::{FromJsonDict, ToJsonDict}; - use pyo3::prelude::*; impl ToJsonDict for GTElement { fn to_json_dict(&self, py: Python<'_>) -> PyResult { diff --git a/crates/chia-bls/src/public_key.rs b/crates/chia-bls/src/public_key.rs index c0e164c61..8c6140083 100644 --- a/crates/chia-bls/src/public_key.rs +++ b/crates/chia-bls/src/public_key.rs @@ -2,8 +2,14 @@ use crate::secret_key::is_all_zero; use crate::{DerivableKey, Error, Result}; use blst::*; +use chia_sha2::Sha256; use chia_traits::{read_bytes, Streamable}; -use clvmr::sha2::Sha256; +#[cfg(feature = "py-bindings")] +use pyo3::exceptions::PyNotImplementedError; +#[cfg(feature = "py-bindings")] +use pyo3::prelude::*; +#[cfg(feature = "py-bindings")] +use pyo3::types::PyType; use std::fmt; use std::hash::{Hash, Hasher}; use std::io::Cursor; @@ -321,6 +327,14 @@ impl PublicKey { other.pair(self) } + #[classmethod] + #[pyo3(name = "from_parent")] + pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: &Self) -> PyResult { + Err(PyNotImplementedError::new_err( + "PublicKey does not support from_parent().", + )) + } + #[pyo3(name = "get_fingerprint")] pub fn py_get_fingerprint(&self) -> u32 { self.get_fingerprint() @@ -353,7 +367,6 @@ mod pybindings { use crate::parse_hex::parse_hex_string; use chia_traits::{FromJsonDict, ToJsonDict}; - use pyo3::prelude::*; impl ToJsonDict for PublicKey { fn to_json_dict(&self, py: Python<'_>) -> PyResult { @@ -737,7 +750,11 @@ mod pytests { let pk = sk.public_key(); Python::with_gil(|py| { let string = pk.to_json_dict(py).expect("to_json_dict"); - let pk2 = PublicKey::from_json_dict(string.bind(py)).unwrap(); + let py_class = py.get_type_bound::(); + let pk2: PublicKey = PublicKey::from_json_dict(&py_class, py, string.bind(py)) + .unwrap() + .extract(py) + .unwrap(); assert_eq!(pk, pk2); }); } @@ -752,8 +769,10 @@ mod pytests { fn test_json_dict(#[case] input: &str, #[case] msg: &str) { pyo3::prepare_freethreaded_python(); Python::with_gil(|py| { + let py_class = py.get_type_bound::(); let err = - PublicKey::from_json_dict(input.to_string().into_py(py).bind(py)).unwrap_err(); + PublicKey::from_json_dict(&py_class, py, input.to_string().into_py(py).bind(py)) + .unwrap_err(); assert_eq!(err.value_bound(py).to_string(), msg.to_string()); }); } diff --git a/crates/chia-bls/src/secret_key.rs b/crates/chia-bls/src/secret_key.rs index 31368b206..591787aa4 100644 --- a/crates/chia-bls/src/secret_key.rs +++ b/crates/chia-bls/src/secret_key.rs @@ -1,8 +1,14 @@ use crate::{DerivableKey, Error, PublicKey, Result}; use blst::*; +use chia_sha2::Sha256; use chia_traits::{read_bytes, Streamable}; -use clvmr::sha2::Sha256; use hkdf::HkdfExtract; +#[cfg(feature = "py-bindings")] +use pyo3::exceptions::PyNotImplementedError; +#[cfg(feature = "py-bindings")] +use pyo3::prelude::*; +#[cfg(feature = "py-bindings")] +use pyo3::types::PyType; use std::fmt; use std::hash::{Hash, Hasher}; use std::io::Cursor; @@ -266,6 +272,14 @@ impl SecretKey { hex::encode(self.to_bytes()) } + #[classmethod] + #[pyo3(name = "from_parent")] + pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: &Self) -> PyResult { + Err(PyNotImplementedError::new_err( + "SecretKey does not support from_parent().", + )) + } + #[pyo3(name = "derive_hardened")] #[must_use] pub fn py_derive_hardened(&self, idx: u32) -> Self { @@ -292,7 +306,6 @@ mod pybindings { use crate::parse_hex::parse_hex_string; use chia_traits::{FromJsonDict, ToJsonDict}; - use pyo3::prelude::*; impl ToJsonDict for SecretKey { fn to_json_dict(&self, py: Python<'_>) -> PyResult { @@ -557,7 +570,11 @@ mod pytests { let sk = SecretKey::from_seed(&data); Python::with_gil(|py| { let string = sk.to_json_dict(py).expect("to_json_dict"); - let sk2 = SecretKey::from_json_dict(string.bind(py)).unwrap(); + let py_class = py.get_type_bound::(); + let sk2 = SecretKey::from_json_dict(&py_class, py, string.bind(py)) + .unwrap() + .extract(py) + .unwrap(); assert_eq!(sk, sk2); assert_eq!(sk.public_key(), sk2.public_key()); }); @@ -588,8 +605,10 @@ mod pytests { fn test_json_dict(#[case] input: &str, #[case] msg: &str) { pyo3::prepare_freethreaded_python(); Python::with_gil(|py| { + let py_class = py.get_type_bound::(); let err = - SecretKey::from_json_dict(input.to_string().into_py(py).bind(py)).unwrap_err(); + SecretKey::from_json_dict(&py_class, py, input.to_string().into_py(py).bind(py)) + .unwrap_err(); assert_eq!(err.value_bound(py).to_string(), msg.to_string()); }); } diff --git a/crates/chia-bls/src/signature.rs b/crates/chia-bls/src/signature.rs index 879200e98..01eed3b9b 100644 --- a/crates/chia-bls/src/signature.rs +++ b/crates/chia-bls/src/signature.rs @@ -1,7 +1,13 @@ use crate::{Error, GTElement, PublicKey, Result, SecretKey}; use blst::*; +use chia_sha2::Sha256; use chia_traits::{read_bytes, Streamable}; -use clvmr::sha2::Sha256; +#[cfg(feature = "py-bindings")] +use pyo3::exceptions::PyNotImplementedError; +#[cfg(feature = "py-bindings")] +use pyo3::prelude::*; +#[cfg(feature = "py-bindings")] +use pyo3::types::PyType; use std::borrow::Borrow; use std::fmt; use std::hash::{Hash, Hasher}; @@ -486,6 +492,14 @@ impl Signature { Self::default() } + #[classmethod] + #[pyo3(name = "from_parent")] + pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: &Self) -> PyResult { + Err(PyNotImplementedError::new_err( + "Signature does not support from_parent().", + )) + } + #[pyo3(name = "pair")] pub fn py_pair(&self, other: &PublicKey) -> GTElement { self.pair(other) @@ -518,7 +532,6 @@ mod pybindings { use crate::parse_hex::parse_hex_string; use chia_traits::{FromJsonDict, ToJsonDict}; - use pyo3::prelude::*; impl ToJsonDict for Signature { fn to_json_dict(&self, py: Python<'_>) -> PyResult { @@ -1259,7 +1272,11 @@ mod pytests { let sig = sign(&sk, msg); Python::with_gil(|py| { let string = sig.to_json_dict(py).expect("to_json_dict"); - let sig2 = Signature::from_json_dict(string.bind(py)).unwrap(); + let py_class = py.get_type_bound::(); + let sig2 = Signature::from_json_dict(&py_class, py, string.bind(py)) + .unwrap() + .extract(py) + .unwrap(); assert_eq!(sig, sig2); }); } @@ -1274,8 +1291,10 @@ mod pytests { fn test_json_dict(#[case] input: &str, #[case] msg: &str) { pyo3::prepare_freethreaded_python(); Python::with_gil(|py| { + let py_class = py.get_type_bound::(); let err = - Signature::from_json_dict(input.to_string().into_py(py).bind(py)).unwrap_err(); + Signature::from_json_dict(&py_class, py, input.to_string().into_py(py).bind(py)) + .unwrap_err(); assert_eq!(err.value_bound(py).to_string(), msg.to_string()); }); } diff --git a/crates/chia-client/Cargo.toml b/crates/chia-client/Cargo.toml index 96be4ee7b..bdb10f519 100644 --- a/crates/chia-client/Cargo.toml +++ b/crates/chia-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chia-client" -version = "0.13.0" +version = "0.14.1" edition = "2021" license = "Apache-2.0" description = "Chia light client and async peer connections." diff --git a/crates/chia-consensus/Cargo.toml b/crates/chia-consensus/Cargo.toml index 9ed5d5242..699c6d625 100644 --- a/crates/chia-consensus/Cargo.toml +++ b/crates/chia-consensus/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chia-consensus" -version = "0.13.0" +version = "0.14.1" edition = "2021" license = "Apache-2.0" description = "Utility functions and types used by the Chia blockchain full node" @@ -12,7 +12,12 @@ repository = "https://github.com/Chia-Network/chia_rs" workspace = true [features] -py-bindings = ["dep:pyo3", "dep:chia_py_streamable_macro"] +py-bindings = [ + "dep:pyo3", + "dep:chia_py_streamable_macro", + "chia-traits/py-bindings", + "chia-protocol/py-bindings" +] [dependencies] clvmr = { workspace = true } @@ -21,9 +26,9 @@ pyo3 = { workspace = true, optional = true } chia_streamable_macro = { workspace = true } chia_py_streamable_macro = { workspace = true, optional = true } clvm-utils = { workspace = true } +chia-sha2 = { workspace = true } chia-traits = { workspace = true } clvm-traits = { workspace = true } -clvm-derive = { workspace = true } chia-protocol = { workspace = true } chia-puzzles = { workspace = true } chia-bls = { workspace = true } diff --git a/crates/chia-consensus/benches/run-generator.rs b/crates/chia-consensus/benches/run-generator.rs index a37b9cb9e..9ee010abf 100644 --- a/crates/chia-consensus/benches/run-generator.rs +++ b/crates/chia-consensus/benches/run-generator.rs @@ -1,5 +1,4 @@ use chia_consensus::consensus_constants::TEST_CONSTANTS; -use chia_consensus::gen::conditions::MempoolVisitor; use chia_consensus::gen::flags::ALLOW_BACKREFS; use chia_consensus::gen::run_block_generator::{run_block_generator, run_block_generator2}; use clvmr::serde::{node_from_bytes, node_to_bytes_backrefs}; @@ -51,7 +50,7 @@ fn run(c: &mut Criterion) { let mut a = Allocator::new(); let start = Instant::now(); - let conds = run_block_generator::<_, MempoolVisitor, _>( + let conds = run_block_generator( &mut a, gen, &block_refs, @@ -69,7 +68,7 @@ fn run(c: &mut Criterion) { let mut a = Allocator::new(); let start = Instant::now(); - let conds = run_block_generator2::<_, MempoolVisitor, _>( + let conds = run_block_generator2( &mut a, gen, &block_refs, diff --git a/crates/chia-consensus/fuzz/Cargo.toml b/crates/chia-consensus/fuzz/Cargo.toml index f7de8dfe2..126f1f604 100644 --- a/crates/chia-consensus/fuzz/Cargo.toml +++ b/crates/chia-consensus/fuzz/Cargo.toml @@ -17,14 +17,11 @@ clvmr = { workspace = true } clvm-utils = { workspace = true } clvm-traits = { workspace = true } chia-protocol = { workspace = true } +chia-sha2 = { workspace = true } chia-traits = { workspace = true } chia-consensus = { workspace = true } hex-literal = { workspace = true } -[lib] -name = "fuzzing_utils" -crate-type = ["rlib"] - [[bin]] name = "puzzle-coin-solution" path = "fuzz_targets/puzzle-coin-solution.rs" @@ -115,3 +112,10 @@ path = "fuzz_targets/merkle-set.rs" test = false doc = false bench = false + +[[bin]] +name = "solution-generator" +path = "fuzz_targets/solution-generator.rs" +test = false +doc = false +bench = false diff --git a/crates/chia-consensus/fuzz/fuzz_targets/merkle-set.rs b/crates/chia-consensus/fuzz/fuzz_targets/merkle-set.rs index d68d276f8..bc3886405 100644 --- a/crates/chia-consensus/fuzz/fuzz_targets/merkle-set.rs +++ b/crates/chia-consensus/fuzz/fuzz_targets/merkle-set.rs @@ -1,6 +1,6 @@ #![no_main] use chia_consensus::merkle_tree::{validate_merkle_proof, MerkleSet}; -use clvmr::sha2::Sha256; +use chia_sha2::Sha256; use libfuzzer_sys::fuzz_target; fuzz_target!(|data: &[u8]| { diff --git a/crates/chia-consensus/fuzz/fuzz_targets/parse-cond-args.rs b/crates/chia-consensus/fuzz/fuzz_targets/parse-cond-args.rs index 5a30b8e8d..e08f41860 100644 --- a/crates/chia-consensus/fuzz/fuzz_targets/parse-cond-args.rs +++ b/crates/chia-consensus/fuzz/fuzz_targets/parse-cond-args.rs @@ -2,8 +2,8 @@ use libfuzzer_sys::fuzz_target; use chia_consensus::gen::conditions::parse_args; +use chia_fuzz::{make_list, BitCursor}; use clvmr::allocator::Allocator; -use fuzzing_utils::{make_list, BitCursor}; use chia_consensus::gen::flags::STRICT_ARGS_COUNT; diff --git a/crates/chia-consensus/fuzz/fuzz_targets/parse-conditions.rs b/crates/chia-consensus/fuzz/fuzz_targets/parse-conditions.rs index 16999caa0..03b80f95a 100644 --- a/crates/chia-consensus/fuzz/fuzz_targets/parse-conditions.rs +++ b/crates/chia-consensus/fuzz/fuzz_targets/parse-conditions.rs @@ -6,11 +6,11 @@ use chia_consensus::gen::conditions::{ parse_conditions, MempoolVisitor, ParseState, SpendBundleConditions, SpendConditions, }; use chia_consensus::gen::spend_visitor::SpendVisitor; +use chia_fuzz::{make_list, BitCursor}; use chia_protocol::Bytes32; use chia_protocol::Coin; use clvm_utils::tree_hash; use clvmr::{Allocator, NodePtr}; -use fuzzing_utils::{make_list, BitCursor}; use std::collections::HashSet; use std::sync::Arc; diff --git a/crates/chia-consensus/fuzz/fuzz_targets/parse-spend-id.rs b/crates/chia-consensus/fuzz/fuzz_targets/parse-spend-id.rs index 3567d4134..fbfb8e324 100644 --- a/crates/chia-consensus/fuzz/fuzz_targets/parse-spend-id.rs +++ b/crates/chia-consensus/fuzz/fuzz_targets/parse-spend-id.rs @@ -2,8 +2,8 @@ use libfuzzer_sys::fuzz_target; use chia_consensus::gen::messages::SpendId; +use chia_fuzz::{make_list, BitCursor}; use clvmr::allocator::Allocator; -use fuzzing_utils::{make_list, BitCursor}; fuzz_target!(|data: &[u8]| { let mut a = Allocator::new(); diff --git a/crates/chia-consensus/fuzz/fuzz_targets/parse-spend.rs b/crates/chia-consensus/fuzz/fuzz_targets/parse-spend.rs index 62e255fb9..f055c5740 100644 --- a/crates/chia-consensus/fuzz/fuzz_targets/parse-spend.rs +++ b/crates/chia-consensus/fuzz/fuzz_targets/parse-spend.rs @@ -2,8 +2,8 @@ use libfuzzer_sys::fuzz_target; use chia_consensus::gen::get_puzzle_and_solution::parse_coin_spend; +use chia_fuzz::{make_list, BitCursor}; use clvmr::allocator::Allocator; -use fuzzing_utils::{make_list, BitCursor}; fuzz_target!(|data: &[u8]| { let mut a = Allocator::new(); diff --git a/crates/chia-consensus/fuzz/fuzz_targets/parse-spends.rs b/crates/chia-consensus/fuzz/fuzz_targets/parse-spends.rs index 8b510918a..84257c734 100644 --- a/crates/chia-consensus/fuzz/fuzz_targets/parse-spends.rs +++ b/crates/chia-consensus/fuzz/fuzz_targets/parse-spends.rs @@ -2,8 +2,8 @@ use libfuzzer_sys::fuzz_target; use chia_consensus::gen::conditions::{parse_spends, MempoolVisitor}; +use chia_fuzz::{make_list, BitCursor}; use clvmr::{Allocator, NodePtr}; -use fuzzing_utils::{make_list, BitCursor}; use chia_consensus::consensus_constants::TEST_CONSTANTS; use chia_consensus::gen::flags::{NO_UNKNOWN_CONDS, STRICT_ARGS_COUNT}; diff --git a/crates/chia-consensus/fuzz/fuzz_targets/process-spend.rs b/crates/chia-consensus/fuzz/fuzz_targets/process-spend.rs index 134ac76e7..8be826dde 100644 --- a/crates/chia-consensus/fuzz/fuzz_targets/process-spend.rs +++ b/crates/chia-consensus/fuzz/fuzz_targets/process-spend.rs @@ -4,8 +4,8 @@ use chia_consensus::gen::conditions::{ process_single_spend, MempoolVisitor, ParseState, SpendBundleConditions, }; use chia_consensus::gen::flags::{NO_UNKNOWN_CONDS, STRICT_ARGS_COUNT}; +use chia_fuzz::{make_tree, BitCursor}; use clvmr::allocator::Allocator; -use fuzzing_utils::{make_tree, BitCursor}; use libfuzzer_sys::fuzz_target; fuzz_target!(|data: &[u8]| { diff --git a/crates/chia-consensus/fuzz/fuzz_targets/puzzle-coin-solution.rs b/crates/chia-consensus/fuzz/fuzz_targets/puzzle-coin-solution.rs index 8f871497a..9dcb5e79f 100644 --- a/crates/chia-consensus/fuzz/fuzz_targets/puzzle-coin-solution.rs +++ b/crates/chia-consensus/fuzz/fuzz_targets/puzzle-coin-solution.rs @@ -2,9 +2,9 @@ use libfuzzer_sys::fuzz_target; use chia_consensus::gen::get_puzzle_and_solution::get_puzzle_and_solution_for_coin; +use chia_fuzz::{make_tree, BitCursor}; use chia_protocol::Coin; use clvmr::allocator::Allocator; -use fuzzing_utils::{make_tree, BitCursor}; use std::collections::HashSet; const HASH: [u8; 32] = [ diff --git a/crates/chia-consensus/fuzz/fuzz_targets/run-generator.rs b/crates/chia-consensus/fuzz/fuzz_targets/run-generator.rs index 0f539a177..b34c03811 100644 --- a/crates/chia-consensus/fuzz/fuzz_targets/run-generator.rs +++ b/crates/chia-consensus/fuzz/fuzz_targets/run-generator.rs @@ -1,7 +1,6 @@ #![no_main] use chia_consensus::allocator::make_allocator; use chia_consensus::consensus_constants::TEST_CONSTANTS; -use chia_consensus::gen::conditions::MempoolVisitor; use chia_consensus::gen::flags::ALLOW_BACKREFS; use chia_consensus::gen::run_block_generator::{run_block_generator, run_block_generator2}; use chia_consensus::gen::validation_error::{ErrorCode, ValidationErr}; @@ -10,7 +9,7 @@ use libfuzzer_sys::fuzz_target; fuzz_target!(|data: &[u8]| { let mut a1 = make_allocator(LIMIT_HEAP); - let r1 = run_block_generator::<&[u8], MempoolVisitor, _>( + let r1 = run_block_generator::<&[u8], _>( &mut a1, data, [], @@ -21,7 +20,7 @@ fuzz_target!(|data: &[u8]| { drop(a1); let mut a2 = make_allocator(LIMIT_HEAP); - let r2 = run_block_generator2::<&[u8], MempoolVisitor, _>( + let r2 = run_block_generator2::<&[u8], _>( &mut a2, data, [], diff --git a/crates/chia-consensus/fuzz/fuzz_targets/solution-generator.rs b/crates/chia-consensus/fuzz/fuzz_targets/solution-generator.rs new file mode 100644 index 000000000..bebcf44a7 --- /dev/null +++ b/crates/chia-consensus/fuzz/fuzz_targets/solution-generator.rs @@ -0,0 +1,42 @@ +#![no_main] +use chia_consensus::gen::solution_generator::{calculate_generator_length, solution_generator}; +use chia_protocol::{Coin, CoinSpend}; +use chia_traits::Streamable; +use clvmr::{ + serde::{node_from_bytes_backrefs, node_to_bytes}, + Allocator, +}; +use libfuzzer_sys::fuzz_target; +use std::io::Cursor; + +fuzz_target!(|data: &[u8]| { + let mut spends = Vec::::new(); + let mut generator_input = Vec::<(Coin, Vec, Vec)>::new(); + let mut data = Cursor::new(data); + let mut discrepancy: i64 = 0; + let mut a = Allocator::new(); + while let Ok(spend) = CoinSpend::parse::(&mut data) { + spends.push(spend.clone()); + generator_input.push(( + spend.coin, + spend.puzzle_reveal.to_vec(), + spend.solution.to_vec(), + )); + // Check for atoms which can be represented in a smaller form + let node = node_from_bytes_backrefs(&mut a, spend.puzzle_reveal.as_ref()).expect("node"); + let puz = node_to_bytes(&a, node).expect("bytes"); + discrepancy += spend.puzzle_reveal.as_ref().len() as i64 - puz.len() as i64; + let node = node_from_bytes_backrefs(&mut a, spend.solution.as_ref()).expect("node"); + let sol = node_to_bytes(&a, node).expect("bytes"); + discrepancy += spend.solution.as_ref().len() as i64 - sol.len() as i64; + } + if spends.is_empty() { + return; + } + let result = solution_generator(generator_input).expect("solution_generator"); + + assert_eq!( + result.len() as i64, + calculate_generator_length(spends) as i64 - discrepancy + ); +}); diff --git a/crates/chia-consensus/src/gen/coin_id.rs b/crates/chia-consensus/src/gen/coin_id.rs index 7b09e84f1..9b06c18f2 100644 --- a/crates/chia-consensus/src/gen/coin_id.rs +++ b/crates/chia-consensus/src/gen/coin_id.rs @@ -1,6 +1,6 @@ use chia_protocol::Bytes32; +use chia_sha2::Sha256; use clvmr::allocator::{Allocator, NodePtr}; -use clvmr::sha2::Sha256; pub fn compute_coin_id( a: &Allocator, diff --git a/crates/chia-consensus/src/gen/conditions.rs b/crates/chia-consensus/src/gen/conditions.rs index e5bf91ca7..e2a491ee3 100644 --- a/crates/chia-consensus/src/gen/conditions.rs +++ b/crates/chia-consensus/src/gen/conditions.rs @@ -17,15 +17,15 @@ use super::opcodes::{ use super::sanitize_int::{sanitize_uint, SanitizedUint}; use super::validation_error::{first, next, rest, ErrorCode, ValidationErr}; use crate::consensus_constants::ConsensusConstants; -use crate::gen::flags::{DISALLOW_INFINITY_G1, NO_UNKNOWN_CONDS, STRICT_ARGS_COUNT}; +use crate::gen::flags::{NO_UNKNOWN_CONDS, STRICT_ARGS_COUNT}; use crate::gen::messages::{Message, SpendId}; use crate::gen::spend_visitor::SpendVisitor; use crate::gen::validation_error::check_nil; use chia_bls::PublicKey; use chia_protocol::Bytes32; +use chia_sha2::Sha256; use clvmr::allocator::{Allocator, NodePtr, SExp}; use clvmr::cost::Cost; -use clvmr::sha2::Sha256; use std::cmp::{max, min}; use std::collections::{HashMap, HashSet}; use std::hash::{Hash, Hasher}; @@ -867,17 +867,13 @@ fn decrement(cnt: &mut u32, n: NodePtr) -> Result<(), ValidationErr> { } } -fn to_key(a: &Allocator, pk: NodePtr, flags: u32) -> Result, ValidationErr> { +fn to_key(a: &Allocator, pk: NodePtr) -> Result { let key = PublicKey::from_bytes(a.atom(pk).as_ref().try_into().expect("internal error")) .map_err(|_| ValidationErr(pk, ErrorCode::InvalidPublicKey))?; if key.is_inf() { - if (flags & DISALLOW_INFINITY_G1) != 0 { - Err(ValidationErr(pk, ErrorCode::InvalidPublicKey)) - } else { - Ok(None) - } + Err(ValidationErr(pk, ErrorCode::InvalidPublicKey)) } else { - Ok(Some(key)) + Ok(key) } } @@ -1124,47 +1120,31 @@ pub fn parse_conditions( state.assert_concurrent_puzzle.insert(id); } Condition::AggSigMe(pk, msg) => { - if let Some(pk) = to_key(a, pk, flags)? { - spend.agg_sig_me.push((pk, msg)); - } + spend.agg_sig_me.push((to_key(a, pk)?, msg)); } Condition::AggSigParent(pk, msg) => { - if let Some(pk) = to_key(a, pk, flags)? { - spend.agg_sig_parent.push((pk, msg)); - } + spend.agg_sig_parent.push((to_key(a, pk)?, msg)); } Condition::AggSigPuzzle(pk, msg) => { - if let Some(pk) = to_key(a, pk, flags)? { - spend.agg_sig_puzzle.push((pk, msg)); - } + spend.agg_sig_puzzle.push((to_key(a, pk)?, msg)); } Condition::AggSigAmount(pk, msg) => { - if let Some(pk) = to_key(a, pk, flags)? { - spend.agg_sig_amount.push((pk, msg)); - } + spend.agg_sig_amount.push((to_key(a, pk)?, msg)); } Condition::AggSigPuzzleAmount(pk, msg) => { - if let Some(pk) = to_key(a, pk, flags)? { - spend.agg_sig_puzzle_amount.push((pk, msg)); - } + spend.agg_sig_puzzle_amount.push((to_key(a, pk)?, msg)); } Condition::AggSigParentAmount(pk, msg) => { - if let Some(pk) = to_key(a, pk, flags)? { - spend.agg_sig_parent_amount.push((pk, msg)); - } + spend.agg_sig_parent_amount.push((to_key(a, pk)?, msg)); } Condition::AggSigParentPuzzle(pk, msg) => { - if let Some(pk) = to_key(a, pk, flags)? { - spend.agg_sig_parent_puzzle.push((pk, msg)); - } + spend.agg_sig_parent_puzzle.push((to_key(a, pk)?, msg)); } Condition::AggSigUnsafe(pk, msg) => { // AGG_SIG_UNSAFE messages are not allowed to end with the // suffix added to other AGG_SIG_* conditions check_agg_sig_unsafe_message(a, msg, constants)?; - if let Some(pk) = to_key(a, pk, flags)? { - ret.agg_sig_unsafe.push((pk, msg)); - } + ret.agg_sig_unsafe.push((to_key(a, pk)?, msg)); } Condition::Softfork(cost) => { if *max_cost < cost { @@ -1280,7 +1260,7 @@ pub fn parse_spends( )?; } - validate_conditions(a, &ret, state, spends, flags)?; + validate_conditions(a, &ret, &state, spends, flags)?; ret.cost = max_cost - cost_left; Ok(ret) @@ -1289,7 +1269,7 @@ pub fn parse_spends( pub fn validate_conditions( a: &Allocator, ret: &SpendBundleConditions, - state: ParseState, + state: &ParseState, spends: NodePtr, _flags: u32, ) -> Result<(), ValidationErr> { @@ -1329,13 +1309,13 @@ pub fn validate_conditions( } // check concurrent spent assertions - for coin_id in state.assert_concurrent_spend { + for coin_id in &state.assert_concurrent_spend { if !state .spent_coins - .contains_key(&Bytes32::try_from(a.atom(coin_id).as_ref()).unwrap()) + .contains_key(&Bytes32::try_from(a.atom(*coin_id).as_ref()).unwrap()) { return Err(ValidationErr( - coin_id, + *coin_id, ErrorCode::AssertConcurrentSpendFailed, )); } @@ -1346,14 +1326,14 @@ pub fn validate_conditions( // expand all the spent puzzle hashes into a set, to allow // fast lookups of all assertions - for ph in state.spent_puzzles { - spent_phs.insert(a.atom(ph).as_ref().try_into().unwrap()); + for ph in &state.spent_puzzles { + spent_phs.insert(a.atom(*ph).as_ref().try_into().unwrap()); } - for puzzle_assert in state.assert_concurrent_puzzle { - if !spent_phs.contains(&a.atom(puzzle_assert).as_ref().try_into().unwrap()) { + for puzzle_assert in &state.assert_concurrent_puzzle { + if !spent_phs.contains(&a.atom(*puzzle_assert).as_ref().try_into().unwrap()) { return Err(ValidationErr( - puzzle_assert, + *puzzle_assert, ErrorCode::AssertConcurrentPuzzleFailed, )); } @@ -1365,41 +1345,41 @@ pub fn validate_conditions( if !state.assert_coin.is_empty() { let mut announcements = HashSet::::new(); - for (coin_id, announce) in state.announce_coin { + for (coin_id, announce) in &state.announce_coin { let mut hasher = Sha256::new(); - hasher.update(*coin_id); - hasher.update(a.atom(announce)); + hasher.update(**coin_id); + hasher.update(a.atom(*announce)); let announcement_id: [u8; 32] = hasher.finalize(); announcements.insert(announcement_id.into()); } - for coin_assert in state.assert_coin { - if !announcements.contains(&a.atom(coin_assert).as_ref().try_into().unwrap()) { + for coin_assert in &state.assert_coin { + if !announcements.contains(&a.atom(*coin_assert).as_ref().try_into().unwrap()) { return Err(ValidationErr( - coin_assert, + *coin_assert, ErrorCode::AssertCoinAnnouncementFailed, )); } } } - for spend_idx in state.assert_ephemeral { + for spend_idx in &state.assert_ephemeral { // make sure this coin was created in this block - if !is_ephemeral(a, spend_idx, &state.spent_coins, &ret.spends) { + if !is_ephemeral(a, *spend_idx, &state.spent_coins, &ret.spends) { return Err(ValidationErr( - ret.spends[spend_idx].parent_id, + ret.spends[*spend_idx].parent_id, ErrorCode::AssertEphemeralFailed, )); } } - for spend_idx in state.assert_not_ephemeral { + for spend_idx in &state.assert_not_ephemeral { // make sure this coin was NOT created in this block // because consensus rules do not allow relative conditions on // ephemeral spends - if is_ephemeral(a, spend_idx, &state.spent_coins, &ret.spends) { + if is_ephemeral(a, *spend_idx, &state.spent_coins, &ret.spends) { return Err(ValidationErr( - ret.spends[spend_idx].parent_id, + ret.spends[*spend_idx].parent_id, ErrorCode::EphemeralRelativeCondition, )); } @@ -1408,18 +1388,18 @@ pub fn validate_conditions( if !state.assert_puzzle.is_empty() { let mut announcements = HashSet::::new(); - for (puzzle_hash, announce) in state.announce_puzzle { + for (puzzle_hash, announce) in &state.announce_puzzle { let mut hasher = Sha256::new(); - hasher.update(a.atom(puzzle_hash)); - hasher.update(a.atom(announce)); + hasher.update(a.atom(*puzzle_hash)); + hasher.update(a.atom(*announce)); let announcement_id: [u8; 32] = hasher.finalize(); announcements.insert(announcement_id.into()); } - for puzzle_assert in state.assert_puzzle { - if !announcements.contains(&a.atom(puzzle_assert).as_ref().try_into().unwrap()) { + for puzzle_assert in &state.assert_puzzle { + if !announcements.contains(&a.atom(*puzzle_assert).as_ref().try_into().unwrap()) { return Err(ValidationErr( - puzzle_assert, + *puzzle_assert, ErrorCode::AssertPuzzleAnnouncementFailed, )); } @@ -1454,19 +1434,6 @@ pub fn validate_conditions( Ok(()) } -#[cfg(test)] -pub(crate) fn u64_to_bytes(n: u64) -> Vec { - let mut buf = Vec::::new(); - buf.extend_from_slice(&n.to_be_bytes()); - if (buf[0] & 0x80) != 0 { - buf.insert(0, 0); - } else { - while buf.len() > 1 && buf[0] == 0 && (buf[1] & 0x80) == 0 { - buf.remove(0); - } - } - buf -} #[cfg(test)] use crate::consensus_constants::TEST_CONSTANTS; #[cfg(test)] @@ -1541,6 +1508,9 @@ const LONGMSG: &[u8; 1025] = &[ 4, ]; +#[cfg(test)] +use crate::gen::make_aggsig_final_message::u64_to_bytes; + #[cfg(test)] fn hash_buf(b1: &[u8], b2: &[u8]) -> Vec { let mut ctx = Sha256::new(); @@ -3123,7 +3093,7 @@ fn test_agg_sig_invalid_pubkey( #[case(AGG_SIG_UNSAFE)] fn test_agg_sig_infinity_pubkey( #[case] condition: ConditionOpcode, - #[values(DISALLOW_INFINITY_G1, 0)] mempool: u32, + #[values(MEMPOOL_MODE, 0)] mempool: u32, ) { let ret = cond_test_flag( &format!( @@ -3133,21 +3103,7 @@ fn test_agg_sig_infinity_pubkey( mempool ); - if mempool != 0 { - assert_eq!(ret.unwrap_err().1, ErrorCode::InvalidPublicKey); - } else { - let ret = ret.expect("expected conditions to be valid").1; - assert!(ret.agg_sig_unsafe.is_empty()); - for c in ret.spends { - assert!(c.agg_sig_me.is_empty()); - assert!(c.agg_sig_parent.is_empty()); - assert!(c.agg_sig_puzzle.is_empty()); - assert!(c.agg_sig_amount.is_empty()); - assert!(c.agg_sig_puzzle_amount.is_empty()); - assert!(c.agg_sig_parent_amount.is_empty()); - assert!(c.agg_sig_parent_puzzle.is_empty()); - } - } + assert_eq!(ret.unwrap_err().1, ErrorCode::InvalidPublicKey); } #[cfg(test)] diff --git a/crates/chia-consensus/src/gen/flags.rs b/crates/chia-consensus/src/gen/flags.rs index a6a97d8a1..830e4d50d 100644 --- a/crates/chia-consensus/src/gen/flags.rs +++ b/crates/chia-consensus/src/gen/flags.rs @@ -1,30 +1,19 @@ use clvmr::MEMPOOL_MODE as CLVM_MEMPOOL_MODE; -// flags controlling to condition parsing +// flags controlling the condition parsing +// These flags are combined in the same fields as clvm_rs flags, controlling the +// CLVM execution. To avoid clashes, CLVM flags are in the lower two bytes and +// condition parsing and validation flags are in the top two bytes. // unknown condition codes are disallowed -pub const NO_UNKNOWN_CONDS: u32 = 0x20000; +pub const NO_UNKNOWN_CONDS: u32 = 0x2_0000; // With this flag, conditions will require the exact number of arguments // currently supported for those conditions. This is meant for mempool-mode -pub const STRICT_ARGS_COUNT: u32 = 0x80000; +pub const STRICT_ARGS_COUNT: u32 = 0x8_0000; // when this flag is set, the block generator serialization is allowed to // contain back-references pub const ALLOW_BACKREFS: u32 = 0x0200_0000; -// When set, the "flags" field of the Spend objects will be set depending on -// what features are detected of the spends -pub const ANALYZE_SPENDS: u32 = 0x0400_0000; - -// When this flag is set, we reject AGG_SIG_* conditions whose public key is the -// infinity G1 point. Such public keys are mathematically valid, but do not -// provide any security guarantees. Chia has historically allowed them. Enabling -// this flag is a soft-fork. -pub const DISALLOW_INFINITY_G1: u32 = 0x1000_0000; - -pub const MEMPOOL_MODE: u32 = CLVM_MEMPOOL_MODE - | NO_UNKNOWN_CONDS - | STRICT_ARGS_COUNT - | ANALYZE_SPENDS - | DISALLOW_INFINITY_G1; +pub const MEMPOOL_MODE: u32 = CLVM_MEMPOOL_MODE | NO_UNKNOWN_CONDS | STRICT_ARGS_COUNT; diff --git a/crates/chia-consensus/src/gen/get_puzzle_and_solution.rs b/crates/chia-consensus/src/gen/get_puzzle_and_solution.rs index f1f742587..53c1e839a 100644 --- a/crates/chia-consensus/src/gen/get_puzzle_and_solution.rs +++ b/crates/chia-consensus/src/gen/get_puzzle_and_solution.rs @@ -61,15 +61,15 @@ pub fn get_puzzle_and_solution_for_coin( mod test { use super::*; use crate::consensus_constants::TEST_CONSTANTS; - use crate::gen::conditions::{u64_to_bytes, MempoolVisitor}; use crate::gen::flags::{ALLOW_BACKREFS, MEMPOOL_MODE}; + use crate::gen::make_aggsig_final_message::u64_to_bytes; use crate::gen::run_block_generator::{run_block_generator2, setup_generator_args}; use chia_protocol::Bytes32; + use chia_sha2::Sha256; use clvm_traits::FromClvm; use clvm_utils::tree_hash; use clvmr::reduction::Reduction; use clvmr::serde::node_from_bytes_backrefs; - use clvmr::sha2::Sha256; use clvmr::{run_program, ChiaDialect}; use rstest::rstest; use std::collections::HashSet; @@ -234,7 +234,7 @@ mod test { let mut a = Allocator::new(); let blocks: &[&[u8]] = &[]; - let conds = run_block_generator2::<_, MempoolVisitor, _>( + let conds = run_block_generator2( &mut a, &generator, blocks, diff --git a/crates/chia-consensus/src/gen/make_aggsig_final_message.rs b/crates/chia-consensus/src/gen/make_aggsig_final_message.rs index 577e9530a..a0ad6dabd 100644 --- a/crates/chia-consensus/src/gen/make_aggsig_final_message.rs +++ b/crates/chia-consensus/src/gen/make_aggsig_final_message.rs @@ -4,7 +4,6 @@ use crate::gen::opcodes::{ AGG_SIG_PARENT_PUZZLE, AGG_SIG_PUZZLE, AGG_SIG_PUZZLE_AMOUNT, }; use crate::gen::owned_conditions::OwnedSpendConditions; -use chia_protocol::Bytes; use chia_protocol::Coin; pub fn make_aggsig_final_message( @@ -51,13 +50,13 @@ pub fn make_aggsig_final_message( } } -fn u64_to_bytes(val: u64) -> Bytes { +pub fn u64_to_bytes(val: u64) -> Vec { let amount_bytes: [u8; 8] = val.to_be_bytes(); if val >= 0x8000_0000_0000_0000_u64 { let mut ret = Vec::::new(); ret.push(0_u8); ret.extend(amount_bytes); - Bytes::new(ret) + ret } else { let start = match val { n if n >= 0x0080_0000_0000_0000_u64 => 0, @@ -70,7 +69,7 @@ fn u64_to_bytes(val: u64) -> Bytes { n if n > 0 => 7, _ => 8, }; - Bytes::new(amount_bytes[start..].to_vec()) + amount_bytes[start..].to_vec() } } diff --git a/crates/chia-consensus/src/gen/owned_conditions.rs b/crates/chia-consensus/src/gen/owned_conditions.rs index 32ba447ae..491d71d54 100644 --- a/crates/chia-consensus/src/gen/owned_conditions.rs +++ b/crates/chia-consensus/src/gen/owned_conditions.rs @@ -8,6 +8,13 @@ use super::conditions::{SpendBundleConditions, SpendConditions}; #[cfg(feature = "py-bindings")] use chia_py_streamable_macro::{PyJsonDict, PyStreamable}; +#[cfg(feature = "py-bindings")] +use pyo3::exceptions::PyNotImplementedError; +#[cfg(feature = "py-bindings")] +use pyo3::prelude::*; +#[cfg(feature = "py-bindings")] +use pyo3::types::PyType; + #[derive(Streamable, Hash, Debug, Clone, Eq, PartialEq)] #[cfg_attr( feature = "py-bindings", @@ -144,3 +151,27 @@ fn convert_agg_sigs(a: &Allocator, agg_sigs: &[(PublicKey, NodePtr)]) -> Vec<(Pu } ret } + +#[cfg(feature = "py-bindings")] +#[pymethods] +impl OwnedSpendConditions { + #[classmethod] + #[pyo3(name = "from_parent")] + pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: &Self) -> PyResult { + Err(PyNotImplementedError::new_err( + "OwnedSpendConditions does not support from_parent().", + )) + } +} + +#[cfg(feature = "py-bindings")] +#[pymethods] +impl OwnedSpendBundleConditions { + #[classmethod] + #[pyo3(name = "from_parent")] + pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: &Self) -> PyResult { + Err(PyNotImplementedError::new_err( + "OwnedSpendBundleConditions does not support from_parent().", + )) + } +} diff --git a/crates/chia-consensus/src/gen/run_block_generator.rs b/crates/chia-consensus/src/gen/run_block_generator.rs index e73ebf01d..af767294f 100644 --- a/crates/chia-consensus/src/gen/run_block_generator.rs +++ b/crates/chia-consensus/src/gen/run_block_generator.rs @@ -1,9 +1,9 @@ use crate::consensus_constants::ConsensusConstants; use crate::gen::conditions::{ - parse_spends, process_single_spend, validate_conditions, ParseState, SpendBundleConditions, + parse_spends, process_single_spend, validate_conditions, EmptyVisitor, ParseState, + SpendBundleConditions, }; use crate::gen::flags::ALLOW_BACKREFS; -use crate::gen::spend_visitor::SpendVisitor; use crate::gen::validation_error::{first, ErrorCode, ValidationErr}; use crate::generator_rom::{CLVM_DESERIALIZER, GENERATOR_ROM}; use clvm_utils::{tree_hash_cached, TreeHash}; @@ -67,7 +67,7 @@ where // the only reason we need to pass in the allocator is because the returned // SpendBundleConditions contains NodePtr fields. If that's changed, we could // create the allocator inside this functions as well. -pub fn run_block_generator, V: SpendVisitor, I: IntoIterator>( +pub fn run_block_generator, I: IntoIterator>( a: &mut Allocator, program: &[u8], block_refs: I, @@ -112,7 +112,8 @@ where // we pass in what's left of max_cost here, to fail early in case the // cost of a condition brings us over the cost limit - let mut result = parse_spends::(a, generator_output, cost_left, flags, constants)?; + let mut result = + parse_spends::(a, generator_output, cost_left, flags, constants)?; result.cost += max_cost - cost_left; Ok(result) } @@ -146,7 +147,7 @@ pub fn extract_n( // you only pay cost for the generator, the puzzles and the conditions). // it also does not apply the stack depth or object allocation limits the same, // as each puzzle run in its own environment. -pub fn run_block_generator2, V: SpendVisitor, I: IntoIterator>( +pub fn run_block_generator2, I: IntoIterator>( a: &mut Allocator, program: &[u8], block_refs: I, @@ -198,7 +199,7 @@ where let buf = tree_hash_cached(a, puzzle, &backrefs, &mut cache); let puzzle_hash = a.new_atom(&buf)?; - process_single_spend::( + process_single_spend::( a, &mut ret, &mut state, @@ -215,7 +216,7 @@ where return Err(ValidationErr(all_spends, ErrorCode::GeneratorRuntimeError)); } - validate_conditions(a, &ret, state, a.nil(), flags)?; + validate_conditions(a, &ret, &state, a.nil(), flags)?; ret.cost = max_cost - cost_left; Ok(ret) diff --git a/crates/chia-consensus/src/gen/solution_generator.rs b/crates/chia-consensus/src/gen/solution_generator.rs index 4ed325a68..1287bb42d 100644 --- a/crates/chia-consensus/src/gen/solution_generator.rs +++ b/crates/chia-consensus/src/gen/solution_generator.rs @@ -1,4 +1,5 @@ use chia_protocol::Coin; +use chia_protocol::CoinSpend; use clvmr::allocator::{Allocator, NodePtr}; use clvmr::serde::{node_from_bytes_backrefs, node_to_bytes, node_to_bytes_backrefs}; use std::io; @@ -39,6 +40,51 @@ where Ok(quote) } +// this function returns the number of bytes the specified +// number is serialized to, in CLVM serialized form +fn clvm_bytes_len(val: u64) -> usize { + if val < 0x80 { + 1 + } else if val < 0x8000 { + 3 + } else if val < 0x0080_0000 { + 4 + } else if val < 0x8000_0000 { + 5 + } else if val < 0x0080_0000_0000 { + 6 + } else if val < 0x8000_0000_0000 { + 7 + } else if val < 0x0080_0000_0000_0000 { + 8 + } else if val < 0x8000_0000_0000_0000 { + 9 + } else { + 10 + } +} + +// calculate the size in bytes of a generator with no backref optimisations +pub fn calculate_generator_length(spends: I) -> usize +where + I: AsRef<[CoinSpend]>, +{ + let mut size: usize = 5; // (q . (())) => ff01ff8080 => 5 bytes + + for s in spends.as_ref() { + let puzzle = s.puzzle_reveal.as_ref(); + let solution = s.solution.as_ref(); + // Each spend has the following form: + // ( parent-id puzzle-reveal amount solution ) + // parent-id is always 32 bytes + 1 byte length prefix = 33 + // + 6 bytes for list extension + // coin amount is already prepended correctly in clvm_bytes_len() + size += 39 + puzzle.len() + clvm_bytes_len(s.coin.amount) + solution.len(); + } + + size +} + // the tuple has the Coin, puzzle-reveal and solution pub fn solution_generator(spends: I) -> io::Result> where @@ -63,8 +109,11 @@ where #[cfg(test)] mod tests { use super::*; + use chia_protocol::Program; + use chia_traits::Streamable; use clvmr::{run_program, ChiaDialect}; use hex_literal::hex; + use rstest::rstest; const PUZZLE1: [u8; 291] = hex!( " @@ -141,11 +190,28 @@ mod tests { 18_375_000_000_000_000_000, ); - let result = solution_generator([ + let spends = [ (coin1, PUZZLE1.as_ref(), SOLUTION1.as_ref()), (coin2, PUZZLE2.as_ref(), SOLUTION2.as_ref()), - ]) - .expect("solution_generator"); + ]; + + let result = solution_generator(spends).expect("solution_generator"); + + assert_eq!( + result.len(), + calculate_generator_length([ + CoinSpend { + coin: coin1, + puzzle_reveal: Program::from(PUZZLE1.as_ref()), + solution: Program::from(SOLUTION1.as_ref()) + }, + CoinSpend { + coin: coin2, + puzzle_reveal: Program::from(PUZZLE2.as_ref()), + solution: Program::from(SOLUTION2.as_ref()) + }, + ]) + ); assert_eq!( result, @@ -194,8 +260,17 @@ mod tests { let generator_output = run_generator(&result); assert_eq!(generator_output, EXPECTED_GENERATOR_OUTPUT); - let result = solution_generator([(coin2, PUZZLE2.as_ref(), SOLUTION2.as_ref())]) - .expect("solution_generator"); + let spends = [(coin2, PUZZLE2.as_ref(), SOLUTION2.as_ref())]; + let result = solution_generator(spends).expect("solution_generator"); + + assert_eq!( + result.len(), + calculate_generator_length([CoinSpend { + coin: coin2, + puzzle_reveal: Program::from(PUZZLE2.as_ref()), + solution: Program::from(SOLUTION2.as_ref()) + },]) + ); assert_eq!( result, @@ -220,6 +295,75 @@ mod tests { ); } + #[test] + fn test_length_calculator() { + let mut spends: Vec<(Coin, &[u8], &[u8])> = Vec::new(); + let mut coin_spends = Vec::::new(); + for i in [ + 0, + 1, + 128, + 129, + 256, + 257, + 4_294_967_296, + 4_294_967_297, + 0x8000_0001, + 0x8000_0000_0001, + 0x8000_0000_0000_0001, + ] { + let coin: Coin = Coin::new( + hex!("ccd5bb71183532bff220ba46c268991a00000000000000000000000000036840").into(), + hex!("fcc78a9e396df6ceebc217d2446bc016e0b3d5922fb32e5783ec5a85d490cfb6").into(), + i, + ); + spends.push((coin, PUZZLE1.as_ref(), SOLUTION1.as_ref())); + coin_spends.push(CoinSpend { + coin, + puzzle_reveal: Program::from(PUZZLE1.as_ref()), + solution: Program::from(SOLUTION1.as_ref()), + }); + let result = solution_generator(spends.clone()).expect("solution_generator"); + + assert_eq!(result.len(), calculate_generator_length(&coin_spends)); + } + } + + #[rstest] + #[case(hex!("f800000000").as_ref(), SOLUTION1.as_ref())] + #[case(hex!("fffffe0000ff41ff013a").as_ref(), SOLUTION1.as_ref())] + #[case(PUZZLE1.as_ref(), hex!("00").as_ref())] + fn test_length_calculator_edge_case(#[case] puzzle: &[u8], #[case] solution: &[u8]) { + let mut spends: Vec<(Coin, &[u8], &[u8])> = Vec::new(); + let mut coin_spends = Vec::::new(); + let mut a = Allocator::new(); + let mut discrepancy: i64 = 0; + + let coin: Coin = Coin::new( + hex!("ccd5bb71183532bff220ba46c268991a00000000000000000000000000036840").into(), + hex!("fcc78a9e396df6ceebc217d2446bc016e0b3d5922fb32e5783ec5a85d490cfb6").into(), + 100, + ); + spends.push((coin, puzzle, solution)); + coin_spends.push(CoinSpend { + coin, + puzzle_reveal: Program::from_bytes(puzzle).expect("puzzle_reveal"), + solution: Program::from_bytes(solution).expect("solution"), + }); + let node = node_from_bytes_backrefs(&mut a, puzzle).expect("puzzle"); + let puz = node_to_bytes(&a, node).expect("bytes"); + discrepancy += puzzle.len() as i64 - puz.len() as i64; + let node = node_from_bytes_backrefs(&mut a, solution).expect("solution"); + let sol = node_to_bytes(&a, node).expect("bytes"); + discrepancy += solution.len() as i64 - sol.len() as i64; + let result = solution_generator(spends.clone()).expect("solution_generator"); + + assert_eq!( + result.len() as i64, + calculate_generator_length(&coin_spends) as i64 - discrepancy + ); + } + #[test] fn test_solution_generator_backre() { let coin1: Coin = Coin::new( @@ -299,4 +443,63 @@ mod tests { let generator_output = run_generator(&result); assert_eq!(generator_output, EXPECTED_GENERATOR_OUTPUT); } + + #[rstest] + #[case(0)] + #[case(1)] + #[case(0x7f)] + #[case(0x80)] + #[case(0xff)] + #[case(0x7fff)] + #[case(0x8000)] + #[case(0xffff)] + #[case(0x7f_ffff)] + #[case(0x80_0000)] + #[case(0xff_ffff)] + #[case(0x7fff_ffff)] + #[case(0x8000_0000)] + #[case(0xffff_ffff)] + #[case(0x7f_ffff_ffff)] + #[case(0x80_0000_0000)] + #[case(0xff_ffff_ffff)] + #[case(0x7fff_ffff_ffff)] + #[case(0x8000_0000_0000)] + #[case(0xffff_ffff_ffff)] + #[case(0x7f_ffff_ffff_ffff)] + #[case(0x80_0000_0000_0000)] + #[case(0xff_ffff_ffff_ffff)] + #[case(0x7fff_ffff_ffff_ffff)] + #[case(0x8000_0000_0000_0000)] + #[case(0xffff_ffff_ffff_ffff)] + #[case(0x7)] + #[case(0x8)] + #[case(0xf)] + #[case(0x7ff)] + #[case(0x800)] + #[case(0xfff)] + #[case(0x7ffff)] + #[case(0x80000)] + #[case(0xfffff)] + #[case(0x7ff_ffff)] + #[case(0x800_0000)] + #[case(0xfff_ffff)] + #[case(0x7_ffff_ffff)] + #[case(0x8_0000_0000)] + #[case(0xf_ffff_ffff)] + #[case(0x7ff_ffff_ffff)] + #[case(0x800_0000_0000)] + #[case(0xfff_ffff_ffff)] + #[case(0x7_ffff_ffff_ffff)] + #[case(0x8_0000_0000_0000)] + #[case(0xf_ffff_ffff_ffff)] + #[case(0x7ff_ffff_ffff_ffff)] + #[case(0x800_0000_0000_0000)] + #[case(0xfff_ffff_ffff_ffff)] + fn test_clvm_bytes_len(#[case] n: u64) { + let len = clvm_bytes_len(n); + let mut a = Allocator::new(); + let atom = a.new_number(n.into()).expect("new_number"); + let bytes = node_to_bytes(&a, atom).expect("node_to_bytes"); + assert_eq!(bytes.len(), len); + } } diff --git a/crates/chia-consensus/src/gen/test_generators.rs b/crates/chia-consensus/src/gen/test_generators.rs index ccef1fed6..ad3ee3388 100644 --- a/crates/chia-consensus/src/gen/test_generators.rs +++ b/crates/chia-consensus/src/gen/test_generators.rs @@ -1,4 +1,4 @@ -use super::conditions::{MempoolVisitor, NewCoin, SpendBundleConditions, SpendConditions}; +use super::conditions::{NewCoin, SpendBundleConditions, SpendConditions}; use super::run_block_generator::{run_block_generator, run_block_generator2}; use crate::allocator::make_allocator; use crate::consensus_constants::TEST_CONSTANTS; @@ -231,7 +231,7 @@ fn run_generator(#[case] name: &str) { for (flags, expected) in zip(&[DEFAULT_FLAGS, DEFAULT_FLAGS | MEMPOOL_MODE], expected) { println!("flags: {flags:x}"); let mut a = make_allocator(*flags); - let conds = run_block_generator::<_, MempoolVisitor, _>( + let conds = run_block_generator( &mut a, &generator, &block_refs, @@ -246,7 +246,7 @@ fn run_generator(#[case] name: &str) { }; let mut a = make_allocator(*flags); - let conds = run_block_generator2::<_, MempoolVisitor, _>( + let conds = run_block_generator2( &mut a, &generator, &block_refs, diff --git a/crates/chia-consensus/src/merkle_set.rs b/crates/chia-consensus/src/merkle_set.rs index fd8135440..5ff480eb0 100644 --- a/crates/chia-consensus/src/merkle_set.rs +++ b/crates/chia-consensus/src/merkle_set.rs @@ -1,4 +1,4 @@ -use clvmr::sha2::Sha256; +use chia_sha2::Sha256; use hex_literal::hex; fn get_bit(val: &[u8; 32], bit: u8) -> u8 { diff --git a/crates/chia-consensus/src/merkle_tree.rs b/crates/chia-consensus/src/merkle_tree.rs index 1533c8141..52a3d53b3 100644 --- a/crates/chia-consensus/src/merkle_tree.rs +++ b/crates/chia-consensus/src/merkle_tree.rs @@ -5,9 +5,9 @@ use hex_literal::hex; #[cfg(feature = "py-bindings")] use chia_protocol::Bytes32; +use chia_sha2::Sha256; #[cfg(feature = "py-bindings")] use chia_traits::ChiaToPython; -use clvmr::sha2::Sha256; #[cfg(feature = "py-bindings")] use pyo3::exceptions::PyValueError; #[cfg(feature = "py-bindings")] diff --git a/crates/chia-consensus/src/spendbundle_conditions.rs b/crates/chia-consensus/src/spendbundle_conditions.rs index 32c307368..c033ce5ba 100644 --- a/crates/chia-consensus/src/spendbundle_conditions.rs +++ b/crates/chia-consensus/src/spendbundle_conditions.rs @@ -4,7 +4,7 @@ use crate::gen::conditions::{ }; use crate::gen::flags::MEMPOOL_MODE; use crate::gen::run_block_generator::subtract_cost; -use crate::gen::solution_generator::solution_generator; +use crate::gen::solution_generator::calculate_generator_length; use crate::gen::validation_error::ValidationErr; use crate::spendbundle_validation::get_flags_for_height_and_constants; use chia_protocol::SpendBundle; @@ -15,6 +15,8 @@ use clvmr::reduction::Reduction; use clvmr::run_program::run_program; use clvmr::serde::node_from_bytes; +const QUOTE_BYTES: usize = 2; + pub fn get_conditions_from_spendbundle( a: &mut Allocator, spend_bundle: &SpendBundle, @@ -22,8 +24,6 @@ pub fn get_conditions_from_spendbundle( height: u32, constants: &ConsensusConstants, ) -> Result { - const QUOTE_BYTES_COST: usize = 2; - let flags = get_flags_for_height_and_constants(height, constants) | MEMPOOL_MODE; // below is an adapted version of the code from run_block_generators::run_block_generator2() @@ -32,17 +32,11 @@ pub fn get_conditions_from_spendbundle( let dialect = ChiaDialect::new(flags); let mut ret = SpendBundleConditions::default(); let mut state = ParseState::default(); - - let spends_info = spend_bundle.coin_spends.iter().map(|coin_spend| { - ( - coin_spend.coin, - &coin_spend.puzzle_reveal, - &coin_spend.solution, - ) - }); // We don't pay the size cost (nor execution cost) of being wrapped by a // quote (in solution_generator). - let generator_length_without_quote = solution_generator(spends_info)?.len() - QUOTE_BYTES_COST; + let generator_length_without_quote = + calculate_generator_length(&spend_bundle.coin_spends) - QUOTE_BYTES; + let byte_cost = generator_length_without_quote as u64 * constants.cost_per_byte; subtract_cost(a, &mut cost_left, byte_cost)?; @@ -72,7 +66,7 @@ pub fn get_conditions_from_spendbundle( )?; } - validate_conditions(a, &ret, state, a.nil(), flags)?; + validate_conditions(a, &ret, &state, a.nil(), flags)?; assert!(max_cost >= cost_left); ret.cost = max_cost - cost_left; Ok(ret) @@ -86,6 +80,7 @@ mod tests { use crate::allocator::make_allocator; use crate::gen::conditions::{ELIGIBLE_FOR_DEDUP, ELIGIBLE_FOR_FF}; use crate::gen::run_block_generator::run_block_generator2; + use crate::gen::solution_generator::solution_generator; use chia_bls::Signature; use chia_protocol::CoinSpend; use chia_traits::Streamable; @@ -93,6 +88,9 @@ mod tests { use rstest::rstest; use std::fs::read; + const QUOTE_EXECUTION_COST: u64 = 20; + const QUOTE_BYTES_COST: u64 = QUOTE_BYTES as u64 * TEST_CONSTANTS.cost_per_byte; + #[rstest] #[case("3000253", 8, 2, 51_216_870)] #[case("1000101", 34, 15, 250_083_677)] @@ -103,9 +101,6 @@ mod tests { #[values(0, 1, 1_000_000, 5_000_000)] height: u32, #[case] cost: u64, ) { - const QUOTE_EXECUTION_COST: u64 = 20; - const QUOTE_BYTE_COST: u64 = 2 * TEST_CONSTANTS.cost_per_byte; - let bundle = SpendBundle::from_bytes( &read(format!("../../test-bundles/{filename}.bundle")).expect("read file"), ) @@ -133,7 +128,7 @@ mod tests { }); let program = solution_generator(program_spends).expect("solution_generator failed"); let blocks: &[&[u8]] = &[]; - let block_conds = run_block_generator2::<_, MempoolVisitor, _>( + let block_conds = run_block_generator2( &mut a, program.as_slice(), blocks, @@ -146,7 +141,7 @@ mod tests { // does not include the overhead to make a block. assert_eq!( conditions.cost, - block_conds.cost - QUOTE_EXECUTION_COST - QUOTE_BYTE_COST + block_conds.cost - QUOTE_EXECUTION_COST - QUOTE_BYTES_COST ); } @@ -312,7 +307,7 @@ mod tests { // of just the spend bundle will be lower let (block_cost, block_output) = { let mut a = make_allocator(DEFAULT_FLAGS); - let block_conds = run_block_generator::<_, MempoolVisitor, _>( + let block_conds = run_block_generator( &mut a, &generator_buffer, &block_refs, @@ -353,7 +348,6 @@ mod tests { &coin_spend.solution, ) }); - const QUOTE_BYTES: usize = 2; let generator_length_without_quote = solution_generator(program_spends) .expect("solution_generator failed") .len() diff --git a/crates/chia-consensus/src/spendbundle_validation.rs b/crates/chia-consensus/src/spendbundle_validation.rs index 9539f2b1e..19b8aaae9 100644 --- a/crates/chia-consensus/src/spendbundle_validation.rs +++ b/crates/chia-consensus/src/spendbundle_validation.rs @@ -1,6 +1,6 @@ use crate::allocator::make_allocator; use crate::consensus_constants::ConsensusConstants; -use crate::gen::flags::{ALLOW_BACKREFS, DISALLOW_INFINITY_G1}; +use crate::gen::flags::ALLOW_BACKREFS; use crate::gen::make_aggsig_final_message::make_aggsig_final_message; use crate::gen::opcodes::{ AGG_SIG_AMOUNT, AGG_SIG_ME, AGG_SIG_PARENT, AGG_SIG_PARENT_AMOUNT, AGG_SIG_PARENT_PUZZLE, @@ -12,8 +12,8 @@ use crate::spendbundle_conditions::get_conditions_from_spendbundle; use chia_bls::GTElement; use chia_bls::{aggregate_verify_gt, hash_to_g2}; use chia_protocol::SpendBundle; -use clvmr::sha2::Sha256; -use clvmr::{ENABLE_BLS_OPS_OUTSIDE_GUARD, ENABLE_FIXED_DIV, LIMIT_HEAP}; +use chia_sha2::Sha256; +use clvmr::LIMIT_HEAP; use std::time::{Duration, Instant}; // type definition makes clippy happy @@ -32,7 +32,7 @@ pub fn validate_clvm_and_signature( let mut a = make_allocator(LIMIT_HEAP); let sbc = get_conditions_from_spendbundle(&mut a, spend_bundle, max_cost, height, constants) .map_err(|e| e.1)?; - let npcresult = OwnedSpendBundleConditions::from(&a, sbc); + let conditions = OwnedSpendBundleConditions::from(&a, sbc); // Collect all pairs in a single vector to avoid multiple iterations let mut pairs = Vec::new(); @@ -40,7 +40,7 @@ pub fn validate_clvm_and_signature( let mut aug_msg = Vec::::new(); let mut final_msg = Vec::::new(); - for spend in &npcresult.spends { + for spend in &conditions.spends { let condition_items_pairs = [ (AGG_SIG_PARENT, &spend.agg_sig_parent), (AGG_SIG_PUZZLE, &spend.agg_sig_puzzle), @@ -67,7 +67,7 @@ pub fn validate_clvm_and_signature( } // Adding unsafe items - for (pk, msg) in &npcresult.agg_sig_unsafe { + for (pk, msg) in &conditions.agg_sig_unsafe { let mut aug_msg = pk.to_bytes().to_vec(); aug_msg.extend_from_slice(msg.as_ref()); let aug_hash = hash_to_g2(&aug_msg); @@ -85,7 +85,7 @@ pub fn validate_clvm_and_signature( } // Collect results - Ok((npcresult, pairs, start_time.elapsed())) + Ok((conditions, pairs, start_time.elapsed())) } fn hash_pk_and_msg(pk: &[u8], msg: &[u8]) -> [u8; 32] { @@ -96,11 +96,7 @@ fn hash_pk_and_msg(pk: &[u8], msg: &[u8]) -> [u8; 32] { } pub fn get_flags_for_height_and_constants(height: u32, constants: &ConsensusConstants) -> u32 { - let mut flags: u32 = ENABLE_FIXED_DIV; - - if height >= constants.soft_fork5_height { - flags |= DISALLOW_INFINITY_G1; - } + let mut flags: u32 = 0; if height >= constants.hard_fork_height { // the hard-fork initiated with 2.0. To activate June 2024 @@ -117,7 +113,7 @@ pub fn get_flags_for_height_and_constants(height: u32, constants: &ConsensusCons // arguments // * Allow the block generator to be serialized with the improved clvm // serialization format (with back-references) - flags = flags | ENABLE_BLS_OPS_OUTSIDE_GUARD | ALLOW_BACKREFS; + flags |= ALLOW_BACKREFS; } flags } @@ -126,7 +122,7 @@ pub fn get_flags_for_height_and_constants(height: u32, constants: &ConsensusCons mod tests { use super::*; use crate::consensus_constants::TEST_CONSTANTS; - use crate::gen::conditions::u64_to_bytes; + use crate::gen::make_aggsig_final_message::u64_to_bytes; use chia_bls::{sign, G2Element, SecretKey, Signature}; use chia_protocol::{Bytes, Bytes32}; use chia_protocol::{Coin, CoinSpend, Program}; @@ -136,10 +132,9 @@ mod tests { use rstest::rstest; #[rstest] - #[case(0, ENABLE_FIXED_DIV)] - #[case(TEST_CONSTANTS.hard_fork_height, ENABLE_BLS_OPS_OUTSIDE_GUARD | ENABLE_FIXED_DIV | ALLOW_BACKREFS)] - #[case(5_716_000, ENABLE_BLS_OPS_OUTSIDE_GUARD | ENABLE_FIXED_DIV | ALLOW_BACKREFS)] - #[case(TEST_CONSTANTS.soft_fork5_height, ENABLE_BLS_OPS_OUTSIDE_GUARD | ENABLE_FIXED_DIV | ALLOW_BACKREFS | DISALLOW_INFINITY_G1)] + #[case(0, 0)] + #[case(TEST_CONSTANTS.hard_fork_height, ALLOW_BACKREFS)] + #[case(5_716_000, ALLOW_BACKREFS)] fn test_get_flags(#[case] height: u32, #[case] expected_value: u32) { assert_eq!( get_flags_for_height_and_constants(height, &TEST_CONSTANTS), diff --git a/crates/chia-datalayer/Cargo.toml b/crates/chia-datalayer/Cargo.toml index b907ca32a..1455c0f4f 100644 --- a/crates/chia-datalayer/Cargo.toml +++ b/crates/chia-datalayer/Cargo.toml @@ -12,13 +12,12 @@ repository = "https://github.com/Chia-Network/chia_rs" workspace = true [features] -py-bindings = ["dep:pyo3", "chia-traits/py-bindings"] +py-bindings = ["dep:pyo3"] [lib] crate-type = ["rlib"] [dependencies] -chia-traits = { workspace = true } clvmr = { workspace = true } pyo3 = { workspace = true, optional = true } diff --git a/crates/chia-protocol/Cargo.toml b/crates/chia-protocol/Cargo.toml index a883c3cb3..6c8ec2cd0 100644 --- a/crates/chia-protocol/Cargo.toml +++ b/crates/chia-protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chia-protocol" -version = "0.13.0" +version = "0.14.1" edition = "2021" license = "Apache-2.0" description = "Chia network protocol message types" @@ -22,6 +22,7 @@ chia_streamable_macro = { workspace = true } chia_py_streamable_macro = { workspace = true, optional = true } clvmr = { workspace = true } chia-traits = { workspace = true } +chia-sha2 = { workspace = true } clvm-traits = { workspace = true, features = ["derive"] } clvm-utils = { workspace = true } chia-bls = { workspace = true } diff --git a/crates/chia-protocol/fuzz/Cargo.toml b/crates/chia-protocol/fuzz/Cargo.toml index 09ee88cba..4ca5c79d5 100644 --- a/crates/chia-protocol/fuzz/Cargo.toml +++ b/crates/chia-protocol/fuzz/Cargo.toml @@ -14,6 +14,7 @@ workspace = true [dependencies] libfuzzer-sys = { workspace = true } clvmr = { workspace = true } +chia-sha2 = { workspace = true } chia-traits = { workspace = true } clvm-traits = { workspace = true } chia-protocol = { workspace = true, features = ["arbitrary"] } diff --git a/crates/chia-protocol/fuzz/fuzz_targets/spend-bundle.rs b/crates/chia-protocol/fuzz/fuzz_targets/spend-bundle.rs index 97106d6c1..89735192a 100644 --- a/crates/chia-protocol/fuzz/fuzz_targets/spend-bundle.rs +++ b/crates/chia-protocol/fuzz/fuzz_targets/spend-bundle.rs @@ -5,7 +5,6 @@ use chia_protocol::{Bytes32, SpendBundle}; use chia_traits::Streamable; use clvm_traits::FromClvm; use clvmr::op_utils::{first, rest}; -use clvmr::ENABLE_FIXED_DIV; use clvmr::{Allocator, NodePtr}; use libfuzzer_sys::fuzz_target; use std::collections::HashSet; @@ -27,7 +26,7 @@ fuzz_target!(|data: &[u8]| { for cs in &bundle.coin_spends { let (cost, mut conds) = cs .puzzle_reveal - .run(&mut a, ENABLE_FIXED_DIV, 11_000_000_000, &cs.solution) + .run(&mut a, 0, 11_000_000_000, &cs.solution) .expect("run"); total_cost += cost; diff --git a/crates/chia-protocol/fuzz/fuzz_targets/streamable.rs b/crates/chia-protocol/fuzz/fuzz_targets/streamable.rs index 300d242b7..684576e5d 100644 --- a/crates/chia-protocol/fuzz/fuzz_targets/streamable.rs +++ b/crates/chia-protocol/fuzz/fuzz_targets/streamable.rs @@ -1,8 +1,8 @@ #![no_main] use arbitrary::{Arbitrary, Unstructured}; use chia_protocol::*; +use chia_sha2::Sha256; use chia_traits::Streamable; -use clvmr::sha2::Sha256; use libfuzzer_sys::fuzz_target; pub fn test_streamable(obj: &T) { diff --git a/crates/chia-protocol/src/bytes.rs b/crates/chia-protocol/src/bytes.rs index 87426e71b..aaf87b2ca 100644 --- a/crates/chia-protocol/src/bytes.rs +++ b/crates/chia-protocol/src/bytes.rs @@ -1,7 +1,7 @@ +use chia_sha2::Sha256; use chia_traits::{chia_error, read_bytes, Streamable}; use clvm_traits::{ClvmDecoder, ClvmEncoder, FromClvm, FromClvmError, ToClvm, ToClvmError}; use clvm_utils::TreeHash; -use clvmr::sha2::Sha256; use clvmr::Atom; use std::array::TryFromSliceError; use std::fmt; diff --git a/crates/chia-protocol/src/coin.rs b/crates/chia-protocol/src/coin.rs index b473b9aa4..4fbb74775 100644 --- a/crates/chia-protocol/src/coin.rs +++ b/crates/chia-protocol/src/coin.rs @@ -1,13 +1,17 @@ use crate::{Bytes32, BytesImpl}; +use chia_sha2::Sha256; use chia_streamable_macro::streamable; use clvm_traits::{ clvm_list, destructure_list, match_list, ClvmDecoder, ClvmEncoder, FromClvm, FromClvmError, ToClvm, ToClvmError, }; -use clvmr::sha2::Sha256; +#[cfg(feature = "py-bindings")] +use pyo3::exceptions::PyNotImplementedError; #[cfg(feature = "py-bindings")] use pyo3::prelude::*; +#[cfg(feature = "py-bindings")] +use pyo3::types::PyType; #[streamable] #[derive(Copy)] @@ -55,6 +59,18 @@ impl Coin { } } +#[cfg(feature = "py-bindings")] +#[pymethods] +impl Coin { + #[classmethod] + #[pyo3(name = "from_parent")] + pub fn from_parent(_cls: &Bound<'_, PyType>, _coin: Self) -> PyResult { + Err(PyNotImplementedError::new_err( + "Coin does not support from_parent().", + )) + } +} + impl> ToClvm for Coin { fn to_clvm(&self, encoder: &mut E) -> Result { clvm_list!(self.parent_coin_info, self.puzzle_hash, self.amount).to_clvm(encoder) diff --git a/crates/chia-protocol/src/coin_spend.rs b/crates/chia-protocol/src/coin_spend.rs index 7e52cba2a..ffbd3c9c1 100644 --- a/crates/chia-protocol/src/coin_spend.rs +++ b/crates/chia-protocol/src/coin_spend.rs @@ -2,6 +2,10 @@ use chia_streamable_macro::streamable; use crate::coin::Coin; use crate::program::Program; +#[cfg(feature = "py-bindings")] +use pyo3::prelude::*; +#[cfg(feature = "py-bindings")] +use pyo3::types::PyType; #[streamable] pub struct CoinSpend { @@ -9,3 +13,16 @@ pub struct CoinSpend { puzzle_reveal: Program, solution: Program, } + +#[cfg(feature = "py-bindings")] +#[pymethods] +impl CoinSpend { + #[classmethod] + #[pyo3(name = "from_parent")] + pub fn from_parent(cls: &Bound<'_, PyType>, py: Python<'_>, cs: Self) -> PyResult { + // Convert result into potential child class + let instance = cls.call1((cs.coin, cs.puzzle_reveal, cs.solution))?; + + Ok(instance.into_py(py)) + } +} diff --git a/crates/chia-protocol/src/program.rs b/crates/chia-protocol/src/program.rs index 978429ed5..45067a97a 100644 --- a/crates/chia-protocol/src/program.rs +++ b/crates/chia-protocol/src/program.rs @@ -1,4 +1,5 @@ use crate::bytes::Bytes; +use chia_sha2::Sha256; use chia_traits::chia_error::{Error, Result}; use chia_traits::Streamable; use clvm_traits::{FromClvm, FromClvmError, ToClvm, ToClvmError}; @@ -10,8 +11,11 @@ use clvmr::serde::{ node_from_bytes, node_from_bytes_backrefs, node_to_bytes, serialized_length_from_bytes, serialized_length_from_bytes_trusted, }; -use clvmr::sha2::Sha256; use clvmr::{Allocator, ChiaDialect}; +#[cfg(feature = "py-bindings")] +use pyo3::prelude::*; +#[cfg(feature = "py-bindings")] +use pyo3::types::PyType; use std::io::Cursor; use std::ops::Deref; @@ -152,9 +156,6 @@ use chia_traits::{FromJsonDict, ToJsonDict}; #[cfg(feature = "py-bindings")] use chia_py_streamable_macro::PyStreamable; -#[cfg(feature = "py-bindings")] -use pyo3::prelude::*; - #[cfg(feature = "py-bindings")] use pyo3::types::{PyList, PyTuple}; @@ -486,6 +487,18 @@ impl ToJsonDict for Program { } } +#[cfg(feature = "py-bindings")] +#[pymethods] +impl Program { + #[classmethod] + #[pyo3(name = "from_parent")] + pub fn from_parent(_cls: &Bound<'_, PyType>, _instance: &Self) -> PyResult { + Err(PyNotImplementedError::new_err( + "This class does not support from_parent().", + )) + } +} + #[cfg(feature = "py-bindings")] impl FromJsonDict for Program { fn from_json_dict(o: &Bound<'_, PyAny>) -> PyResult { diff --git a/crates/chia-protocol/src/spend_bundle.rs b/crates/chia-protocol/src/spend_bundle.rs index 62778fa65..b5ab9dc9b 100644 --- a/crates/chia-protocol/src/spend_bundle.rs +++ b/crates/chia-protocol/src/spend_bundle.rs @@ -10,10 +10,11 @@ use clvmr::cost::Cost; use clvmr::op_utils::{first, rest}; use clvmr::reduction::EvalErr; use clvmr::Allocator; -use clvmr::ENABLE_FIXED_DIV; #[cfg(feature = "py-bindings")] use pyo3::prelude::*; +#[cfg(feature = "py-bindings")] +use pyo3::types::PyType; #[streamable(subclass)] pub struct SpendBundle { @@ -50,9 +51,7 @@ impl SpendBundle { for cs in &self.coin_spends { a.restore_checkpoint(&checkpoint); - let (cost, mut conds) = - cs.puzzle_reveal - .run(&mut a, ENABLE_FIXED_DIV, cost_left, &cs.solution)?; + let (cost, mut conds) = cs.puzzle_reveal.run(&mut a, 0, cost_left, &cs.solution)?; if cost > cost_left { return Err(EvalErr(a.nil(), "cost exceeded".to_string())); } @@ -94,10 +93,36 @@ impl SpendBundle { #[pymethods] #[allow(clippy::needless_pass_by_value)] impl SpendBundle { - #[staticmethod] + #[classmethod] #[pyo3(name = "aggregate")] - fn py_aggregate(spend_bundles: Vec) -> SpendBundle { - SpendBundle::aggregate(&spend_bundles) + fn py_aggregate( + cls: &Bound<'_, PyType>, + py: Python<'_>, + spend_bundles: Vec, + ) -> PyResult { + let aggregated = Bound::new(py, Self::aggregate(&spend_bundles))?; + if aggregated.is_exact_instance(cls) { + Ok(aggregated.into_py(py)) + } else { + let instance = cls.call_method1("from_parent", (aggregated.into_py(py),))?; + Ok(instance.into_py(py)) + } + } + + #[classmethod] + #[pyo3(name = "from_parent")] + pub fn from_parent( + cls: &Bound<'_, PyType>, + py: Python<'_>, + spend_bundle: Self, + ) -> PyResult { + // Convert result into potential child class + let instance = cls.call( + (spend_bundle.coin_spends, spend_bundle.aggregated_signature), + None, + )?; + + Ok(instance.into_py(py)) } #[pyo3(name = "name")] diff --git a/crates/chia-puzzles/Cargo.toml b/crates/chia-puzzles/Cargo.toml index ab9fe61ad..9e45357ad 100644 --- a/crates/chia-puzzles/Cargo.toml +++ b/crates/chia-puzzles/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chia-puzzles" -version = "0.13.0" +version = "0.14.1" edition = "2021" license = "Apache-2.0" description = "Chia primitives needed for building wallets." @@ -20,6 +20,7 @@ num-bigint = { workspace = true } hex-literal = { workspace = true } clvm-utils = { workspace = true } clvm-traits = { workspace = true, features = ["chia-bls"] } +chia-sha2 = { workspace = true } chia-bls = { workspace = true } chia-protocol = { workspace = true } arbitrary = { workspace = true, features = ["derive"], optional = true } diff --git a/crates/chia-puzzles/fuzz/Cargo.toml b/crates/chia-puzzles/fuzz/Cargo.toml index aa7507ebd..fa1ffa254 100644 --- a/crates/chia-puzzles/fuzz/Cargo.toml +++ b/crates/chia-puzzles/fuzz/Cargo.toml @@ -14,7 +14,6 @@ workspace = true [dependencies] libfuzzer-sys = { workspace = true } clvmr = { workspace = true } -pyo3 = { workspace = true, features = ["auto-initialize"]} chia-puzzles = { workspace = true, features = ["arbitrary"] } clvm-traits = { workspace = true } diff --git a/crates/chia-puzzles/src/derive_synthetic.rs b/crates/chia-puzzles/src/derive_synthetic.rs index d845586f0..9e03d7b90 100644 --- a/crates/chia-puzzles/src/derive_synthetic.rs +++ b/crates/chia-puzzles/src/derive_synthetic.rs @@ -1,5 +1,5 @@ use chia_bls::{PublicKey, SecretKey}; -use clvmr::sha2::Sha256; +use chia_sha2::Sha256; use hex_literal::hex; use num_bigint::BigInt; diff --git a/crates/chia-sha2/Cargo.toml b/crates/chia-sha2/Cargo.toml new file mode 100644 index 000000000..c93fd2887 --- /dev/null +++ b/crates/chia-sha2/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "chia-sha2" +version = "0.14.1" +edition = "2021" +license = "Apache-2.0" +description = "A common wrapper around OpenSSL and sha2 implementations of sha256." +authors = ["Brandon Haggstrom "] +homepage = "https://github.com/Chia-Network/chia_rs" +repository = "https://github.com/Chia-Network/chia_rs" + +[lints] +workspace = true + +[features] +openssl = ["dep:openssl"] + +[dependencies] +sha2 = { workspace = true } +openssl = { workspace = true, optional = true } diff --git a/crates/chia-sha2/src/lib.rs b/crates/chia-sha2/src/lib.rs new file mode 100644 index 000000000..267392057 --- /dev/null +++ b/crates/chia-sha2/src/lib.rs @@ -0,0 +1,61 @@ +#[cfg(not(feature = "openssl"))] +use sha2::Digest; + +#[derive(Default, Clone)] +pub struct Sha256 { + #[cfg(feature = "openssl")] + ctx: openssl::sha::Sha256, + + #[cfg(not(feature = "openssl"))] + ctx: sha2::Sha256, +} + +impl Sha256 { + pub fn new() -> Self { + Self::default() + } + pub fn update(&mut self, buf: impl AsRef<[u8]>) { + self.ctx.update(buf.as_ref()); + } + pub fn finalize(self) -> [u8; 32] { + #[cfg(feature = "openssl")] + { + self.ctx.finish() + } + #[cfg(not(feature = "openssl"))] + { + self.ctx.finalize().into() + } + } +} + +#[test] +fn test_sha256() { + // https://www.di-mgt.com.au/sha_testvectors.html + + let output = &[ + 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, + 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, + 0x15, 0xad, + ]; + + let mut ctx = Sha256::new(); + ctx.update([0x61, 0x62, 0x63]); + assert_eq!(&ctx.finalize().as_slice(), output); + + let mut ctx = Sha256::new(); + ctx.update([0x61]); + ctx.update([0x62]); + ctx.update([0x63]); + assert_eq!(&ctx.finalize().as_slice(), output); + + let mut ctx = Sha256::new(); + ctx.update([0x61, 0x62]); + ctx.update([0x63]); + assert_eq!(&ctx.finalize().as_slice(), output); + + let mut ctx = Sha256::new(); + ctx.update([0x61]); + ctx.update([0x62, 0x63]); + assert_eq!(&ctx.finalize().as_slice(), output); +} diff --git a/crates/chia-tools/Cargo.toml b/crates/chia-tools/Cargo.toml index aca350373..51872f351 100644 --- a/crates/chia-tools/Cargo.toml +++ b/crates/chia-tools/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chia-tools" -version = "0.13.0" +version = "0.14.1" edition = "2021" license = "Apache-2.0" description = "Utility functions and types used by the Chia blockchain full node" @@ -25,7 +25,6 @@ clap = { workspace = true, features = ["derive"] } zstd = { workspace = true } blocking-threadpool = { workspace = true } hex = { workspace = true } -hex-literal = { workspace = true } [lib] name = "chia_tools" diff --git a/crates/chia-tools/src/bin/analyze-chain.rs b/crates/chia-tools/src/bin/analyze-chain.rs index 485f0f2de..0ab55631d 100644 --- a/crates/chia-tools/src/bin/analyze-chain.rs +++ b/crates/chia-tools/src/bin/analyze-chain.rs @@ -4,7 +4,6 @@ use std::io::Write; use std::time::SystemTime; use chia_consensus::consensus_constants::TEST_CONSTANTS; -use chia_consensus::gen::conditions::EmptyVisitor; use chia_consensus::gen::flags::{ALLOW_BACKREFS, MEMPOOL_MODE}; use chia_consensus::gen::run_block_generator::{run_block_generator, run_block_generator2}; use chia_tools::iterate_tx_blocks; @@ -51,9 +50,9 @@ fn main() { // after the hard fork, we run blocks without paying for the // CLVM generator ROM let block_runner = if height >= 5_496_000 { - run_block_generator2::<_, EmptyVisitor, _> + run_block_generator2 } else { - run_block_generator::<_, EmptyVisitor, _> + run_block_generator }; let generator = block diff --git a/crates/chia-tools/src/bin/gen-corpus.rs b/crates/chia-tools/src/bin/gen-corpus.rs index 4ffb58e9d..34a00c70e 100644 --- a/crates/chia-tools/src/bin/gen-corpus.rs +++ b/crates/chia-tools/src/bin/gen-corpus.rs @@ -15,9 +15,11 @@ use clvm_traits::FromClvm; use clvm_utils::{tree_hash, CurriedProgram}; use clvmr::allocator::NodePtr; use clvmr::Allocator; +use core::sync::atomic::Ordering; use std::collections::HashSet; -use std::fs::write; +use std::fs::{write, File}; use std::io::Write; +use std::sync::atomic::AtomicUsize; use std::sync::{Arc, Mutex}; use std::thread::available_parallelism; use std::time::{Duration, Instant}; @@ -37,6 +39,14 @@ struct Args { #[arg(long, default_value_t = false)] spend_bundles: bool, + /// generate corpus for solution-generator + #[arg(long, default_value_t = false)] + coin_spends: bool, + + /// generate corpus for run-puzzle + #[arg(long, default_value_t = false)] + puzzles: bool, + /// stop running block generators when reaching this height #[arg(short, long)] max_height: Option, @@ -62,6 +72,7 @@ fn main() { let mut last_height = 0; let mut last_time = Instant::now(); + let corpus_counter = Arc::new(AtomicUsize::new(0)); iterate_tx_blocks( &args.file, args.start_height, @@ -73,6 +84,7 @@ fn main() { let seen_puzzles = seen_puzzles.clone(); let seen_singletons = seen_singletons.clone(); + let cnt = corpus_counter.clone(); pool.execute(move || { let mut a = Allocator::new_limited(500_000_000); @@ -93,11 +105,13 @@ fn main() { _ => puzzle_hash, }; - let run_puzzle = seen_puzzles.lock().unwrap().insert(mod_hash); + let seen_puzzle = seen_puzzles.lock().unwrap().insert(mod_hash); + let run_puzzle = args.puzzles && seen_puzzle; let fast_forward = (mod_hash == SINGLETON_TOP_LAYER_PUZZLE_HASH.into()) && seen_singletons.lock().unwrap().insert(puzzle_hash); - if !run_puzzle && !fast_forward && !args.spend_bundles { + if !run_puzzle && !fast_forward && !args.spend_bundles && !args.coin_spends + { return; } let puzzle_reveal = Program::from_clvm(a, puzzle).expect("puzzle reveal"); @@ -113,49 +127,68 @@ fn main() { solution, }; - if args.spend_bundles { + if (args.spend_bundles || args.coin_spends) && !seen_puzzle { bundle.coin_spends.push(spend.clone()); } if !run_puzzle && !fast_forward { return; } - let mut bytes = Vec::::new(); - spend.stream(&mut bytes).expect("stream CoinSpend"); + let bytes = spend.to_bytes().expect("stream CoinSpend"); if run_puzzle { let directory = "../chia-consensus/fuzz/corpus/run-puzzle"; let _ = std::fs::create_dir_all(directory); write(format!("{directory}/{mod_hash}.spend"), &bytes).expect("write"); - println!("{height}: {mod_hash}"); + cnt.fetch_add(1, Ordering::Relaxed); } if fast_forward { let directory = "../chia-consensus/fuzz/corpus/fast-forward"; let _ = std::fs::create_dir_all(directory); - write(format!("{directory}/{puzzle_hash}.spend"), bytes) + write(format!("{directory}/{puzzle_hash}.spend"), &bytes) .expect("write"); - println!("{height}: {puzzle_hash}"); + cnt.fetch_add(1, Ordering::Relaxed); } }, ) .expect("failed to run block generator"); - if args.spend_bundles { + if args.spend_bundles && !bundle.coin_spends.is_empty() { let directory = "../chia-protocol/fuzz/corpus/spend-bundle"; let _ = std::fs::create_dir_all(directory); let bytes = bundle.to_bytes().expect("to_bytes"); write(format!("{directory}/{height}.bundle"), bytes).expect("write"); + cnt.fetch_add(1, Ordering::Relaxed); + } + + if args.coin_spends && !bundle.coin_spends.is_empty() { + let directory = "../chia-consensus/fuzz/corpus/solution-generator"; + let _ = std::fs::create_dir_all(directory); + let mut f = + File::create(format!("{directory}/{height}.spends")).expect("open file"); + for cs in &bundle.coin_spends { + f.write_all(&cs.to_bytes().expect("CoinSpend serialize")) + .expect("file write"); + } + cnt.fetch_add(1, Ordering::Relaxed); } }); if last_time.elapsed() > Duration::new(4, 0) { let rate = f64::from(height - last_height) / last_time.elapsed().as_secs_f64(); - print!("\rheight: {height} ({rate:0.1} blocks/s) "); + print!( + "\rheight: {height} ({rate:0.1} blocks/s) corpus: {} ", + corpus_counter.load(Ordering::Relaxed) + ); let _ = std::io::stdout().flush(); last_height = height; last_time = Instant::now(); } }, ); + print!( + "\nwrote {} examples to the fuzzing corpus", + corpus_counter.load(Ordering::Relaxed) + ); assert_eq!(pool.panic_count(), 0); diff --git a/crates/chia-tools/src/bin/test-block-generators.rs b/crates/chia-tools/src/bin/test-block-generators.rs index a02387aa0..e03084f5d 100644 --- a/crates/chia-tools/src/bin/test-block-generators.rs +++ b/crates/chia-tools/src/bin/test-block-generators.rs @@ -2,9 +2,7 @@ use clap::Parser; use chia_bls::PublicKey; use chia_consensus::consensus_constants::TEST_CONSTANTS; -use chia_consensus::gen::conditions::{ - EmptyVisitor, NewCoin, SpendBundleConditions, SpendConditions, -}; +use chia_consensus::gen::conditions::{NewCoin, SpendBundleConditions, SpendConditions}; use chia_consensus::gen::flags::{ALLOW_BACKREFS, MEMPOOL_MODE}; use chia_consensus::gen::run_block_generator::{run_block_generator, run_block_generator2}; use chia_tools::iterate_tx_blocks; @@ -161,9 +159,9 @@ fn main() { // after the hard fork, we run blocks without paying for the // CLVM generator ROM let block_runner = if height >= 5_496_000 { - run_block_generator2::<_, EmptyVisitor, _> + run_block_generator2 } else { - run_block_generator::<_, EmptyVisitor, _> + run_block_generator }; let mut conditions = @@ -183,7 +181,7 @@ fn main() { } if args.validate { - let mut baseline = run_block_generator::<_, EmptyVisitor, _>( + let mut baseline = run_block_generator( &mut a, generator.as_ref(), &block_refs, diff --git a/crates/chia-traits/Cargo.toml b/crates/chia-traits/Cargo.toml index 9dadf80f9..c8efd9acc 100644 --- a/crates/chia-traits/Cargo.toml +++ b/crates/chia-traits/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chia-traits" -version = "0.11.0" +version = "0.14.1" edition = "2021" license = "Apache-2.0" description = "Chia traits for Streamable types (chia's serialization format)" @@ -13,7 +13,7 @@ workspace = true py-bindings = ["dep:pyo3"] [dependencies] +chia-sha2 = { workspace = true } pyo3 = { workspace = true, features = ["multiple-pymethods"], optional = true } chia_streamable_macro = { workspace = true } -clvmr = { workspace = true } thiserror = { workspace = true } diff --git a/crates/chia-traits/src/streamable.rs b/crates/chia-traits/src/streamable.rs index 5e07576ff..6be2dab34 100644 --- a/crates/chia-traits/src/streamable.rs +++ b/crates/chia-traits/src/streamable.rs @@ -1,5 +1,5 @@ use crate::chia_error::{Error, Result}; -use clvmr::sha2::Sha256; +use chia_sha2::Sha256; use std::io::Cursor; use std::mem; diff --git a/crates/chia_py_streamable_macro/Cargo.toml b/crates/chia_py_streamable_macro/Cargo.toml index c9dfd687a..7bc188af0 100644 --- a/crates/chia_py_streamable_macro/Cargo.toml +++ b/crates/chia_py_streamable_macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chia_py_streamable_macro" -version = "0.13.0" +version = "0.14.1" edition = "2021" license = "Apache-2.0" description = "Derive macro to create python bindings for Chia types" diff --git a/crates/chia_py_streamable_macro/src/lib.rs b/crates/chia_py_streamable_macro/src/lib.rs index 9ab532b77..1d77d83d6 100644 --- a/crates/chia_py_streamable_macro/src/lib.rs +++ b/crates/chia_py_streamable_macro/src/lib.rs @@ -127,28 +127,30 @@ pub fn py_streamable_macro(input: proc_macro::TokenStream) -> proc_macro::TokenS } }); - py_protocol.extend(quote! { - #[pyo3::pymethods] - impl #ident { - #[pyo3(signature = (**kwargs))] - fn replace(&self, kwargs: Option<&pyo3::types::PyDict>) -> pyo3::PyResult { - let mut ret = self.clone(); - if let Some(kwargs) = kwargs { - let iter: pyo3::types::iter::PyDictIterator = kwargs.iter(); - for (field, value) in iter { - let field = field.extract::()?; - match field.as_str() { - #(stringify!(#fnames_maybe_upper) => { - ret.#fnames = value.extract()?; - }),* - _ => { return Err(pyo3::exceptions::PyKeyError::new_err(format!("unknown field {field}"))); } + if !named.is_empty() { + py_protocol.extend(quote! { + #[pyo3::pymethods] + impl #ident { + #[pyo3(signature = (**kwargs))] + fn replace(&self, kwargs: Option<&pyo3::types::PyDict>) -> pyo3::PyResult { + let mut ret = self.clone(); + if let Some(kwargs) = kwargs { + let iter: pyo3::types::iter::PyDictIterator = kwargs.iter(); + for (field, value) in iter { + let field = field.extract::()?; + match field.as_str() { + #(stringify!(#fnames_maybe_upper) => { + ret.#fnames = value.extract()?; + }),* + _ => { return Err(pyo3::exceptions::PyKeyError::new_err(format!("unknown field {field}"))); } + } } } + Ok(ret) } - Ok(ret) } - } - }); + }); + } } syn::Fields::Unnamed(FieldsUnnamed { .. }) => {} syn::Fields::Unit => { @@ -159,10 +161,25 @@ pub fn py_streamable_macro(input: proc_macro::TokenStream) -> proc_macro::TokenS py_protocol.extend(quote! { #[pyo3::pymethods] impl #ident { - #[staticmethod] + #[classmethod] #[pyo3(signature=(json_dict))] - pub fn from_json_dict(json_dict: &pyo3::Bound) -> pyo3::PyResult { - ::from_json_dict(json_dict) + pub fn from_json_dict(cls: &pyo3::Bound<'_, pyo3::types::PyType>, py: pyo3::Python<'_>, json_dict: &pyo3::Bound) -> pyo3::PyResult { + use pyo3::prelude::PyAnyMethods; + use pyo3::IntoPy; + use pyo3::Bound; + use pyo3::type_object::PyTypeInfo; + use std::borrow::Borrow; + let rust_obj = Bound::new(py, ::from_json_dict(json_dict)?)?; + + // Check if python class is different from rust class (in case of child classes) + // if so call the python class's conversion code + + if rust_obj.is_exact_instance(&cls) { + Ok(rust_obj.into_py(py)) + } else { + let instance = cls.call_method1("from_parent", (rust_obj.into_py(py),))?; + Ok(instance.into_py(py)) + } } pub fn to_json_dict(&self, py: pyo3::Python) -> pyo3::PyResult { @@ -174,34 +191,70 @@ pub fn py_streamable_macro(input: proc_macro::TokenStream) -> proc_macro::TokenS let streamable = quote! { #[pyo3::pymethods] impl #ident { - #[staticmethod] + #[classmethod] #[pyo3(name = "from_bytes")] - pub fn py_from_bytes(blob: pyo3::buffer::PyBuffer) -> pyo3::PyResult { + pub fn py_from_bytes(cls: &pyo3::Bound<'_, pyo3::types::PyType>, py: pyo3::Python<'_>, blob: pyo3::buffer::PyBuffer) -> pyo3::PyResult { + use pyo3::prelude::PyAnyMethods; + use pyo3::IntoPy; + use pyo3::Bound; + use pyo3::type_object::PyTypeInfo; + use std::borrow::Borrow; + if !blob.is_c_contiguous() { panic!("from_bytes() must be called with a contiguous buffer"); } let slice = unsafe { std::slice::from_raw_parts(blob.buf_ptr() as *const u8, blob.len_bytes()) }; - ::from_bytes(slice).map_err(|e| <#crate_name::chia_error::Error as Into>::into(e)) + let rust_obj = Bound::new(py, ::from_bytes(slice)?)?; + + // Check if python class is different from rust class (in case of child classes) + // if so call the python class's conversion code + + if rust_obj.is_exact_instance(&cls) { + Ok(rust_obj.into_py(py)) + } else { + let instance = cls.call_method1("from_parent", (rust_obj.into_py(py),))?; + Ok(instance.into_py(py)) + } } - #[staticmethod] + #[classmethod] #[pyo3(name = "from_bytes_unchecked")] - pub fn py_from_bytes_unchecked(blob: pyo3::buffer::PyBuffer) -> pyo3::PyResult { + pub fn py_from_bytes_unchecked(cls: &pyo3::Bound<'_, pyo3::types::PyType>, py: pyo3::Python<'_>, blob: pyo3::buffer::PyBuffer) -> pyo3::PyResult { + use pyo3::prelude::PyAnyMethods; + use pyo3::IntoPy; + use pyo3::Bound; + use pyo3::type_object::PyTypeInfo; + use std::borrow::Borrow; if !blob.is_c_contiguous() { panic!("from_bytes_unchecked() must be called with a contiguous buffer"); } let slice = unsafe { std::slice::from_raw_parts(blob.buf_ptr() as *const u8, blob.len_bytes()) }; - ::from_bytes_unchecked(slice).map_err(|e| <#crate_name::chia_error::Error as Into>::into(e)) + let rust_obj = Bound::new(py, ::from_bytes_unchecked(slice).map_err(|e| <#crate_name::chia_error::Error as Into>::into(e))?)?; + + // Check if python class is different from rust class (in case of child classes) + // if so call the python class's conversion code + + if rust_obj.is_exact_instance(&cls) { + Ok(rust_obj.into_py(py)) + } else { + let instance = cls.call_method1("from_parent", (rust_obj.into_py(py),))?; + Ok(instance.into_py(py)) + } } // returns the type as well as the number of bytes read from the buffer - #[staticmethod] + #[classmethod] #[pyo3(signature= (blob, trusted=false))] - pub fn parse_rust<'p>(blob: pyo3::buffer::PyBuffer, trusted: bool) -> pyo3::PyResult<(Self, u32)> { + pub fn parse_rust<'p>(cls: &pyo3::Bound<'_, pyo3::types::PyType>, py: pyo3::Python<'_>, blob: pyo3::buffer::PyBuffer, trusted: bool) -> pyo3::PyResult<(pyo3::PyObject, u32)> { + use pyo3::prelude::PyAnyMethods; + use pyo3::IntoPy; + use pyo3::Bound; + use pyo3::type_object::PyTypeInfo; + use std::borrow::Borrow; if !blob.is_c_contiguous() { panic!("parse_rust() must be called with a contiguous buffer"); } @@ -209,10 +262,22 @@ pub fn py_streamable_macro(input: proc_macro::TokenStream) -> proc_macro::TokenS std::slice::from_raw_parts(blob.buf_ptr() as *const u8, blob.len_bytes()) }; let mut input = std::io::Cursor::<&[u8]>::new(slice); - if trusted { + let rust_obj = if trusted { ::parse::(&mut input).map_err(|e| <#crate_name::chia_error::Error as Into>::into(e)).map(|v| (v, input.position() as u32)) } else { ::parse::(&mut input).map_err(|e| <#crate_name::chia_error::Error as Into>::into(e)).map(|v| (v, input.position() as u32)) + }?; + + // Check if python class is different from rust class (in case of child classes) + // if so call the python class's conversion code + + let rust_obj = (Bound::new(py, rust_obj.0)?, rust_obj.1); + + if rust_obj.0.is_exact_instance(&cls) { + Ok((rust_obj.0.into_py(py), rust_obj.1)) + } else { + let instance = cls.call_method1("from_parent", (rust_obj.0.into_py(py),))?; + Ok((instance.into_py(py), rust_obj.1)) } } @@ -220,7 +285,7 @@ pub fn py_streamable_macro(input: proc_macro::TokenStream) -> proc_macro::TokenS use pyo3::IntoPy; use pyo3::types::PyModule; use pyo3::prelude::PyAnyMethods; - let mut ctx = clvmr::sha2::Sha256::new(); + let mut ctx = chia_sha2::Sha256::new(); #crate_name::Streamable::update_digest(self, &mut ctx); let bytes_module = PyModule::import_bound(py, "chia_rs.sized_bytes")?; let ty = bytes_module.getattr("bytes32")?; diff --git a/crates/chia_streamable_macro/Cargo.toml b/crates/chia_streamable_macro/Cargo.toml index 9e6e3c3e5..3cf796f7a 100644 --- a/crates/chia_streamable_macro/Cargo.toml +++ b/crates/chia_streamable_macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chia_streamable_macro" -version = "0.11.0" +version = "0.14.1" edition = "2021" license = "Apache-2.0" description = "Streamable derive macro for serializing/deserializing types in Chia protocol format" @@ -15,7 +15,6 @@ workspace = true proc-macro = true [dependencies] -clvmr = { workspace = true } syn = { workspace = true } quote = { workspace = true } proc-macro-crate = { workspace = true } diff --git a/crates/chia_streamable_macro/src/lib.rs b/crates/chia_streamable_macro/src/lib.rs index 357dbd16e..e04f51df8 100644 --- a/crates/chia_streamable_macro/src/lib.rs +++ b/crates/chia_streamable_macro/src/lib.rs @@ -165,7 +165,7 @@ pub fn chia_streamable_macro(input: TokenStream) -> TokenStream { } let ret = quote! { impl #crate_name::Streamable for #ident { - fn update_digest(&self, digest: &mut clvmr::sha2::Sha256) { + fn update_digest(&self, digest: &mut chia_sha2::Sha256) { ::update_digest(&(*self as u8), digest); } fn stream(&self, out: &mut Vec) -> #crate_name::chia_error::Result<()> { @@ -205,7 +205,7 @@ pub fn chia_streamable_macro(input: TokenStream) -> TokenStream { if !fnames.is_empty() { let ret = quote! { impl #crate_name::Streamable for #ident { - fn update_digest(&self, digest: &mut clvmr::sha2::Sha256) { + fn update_digest(&self, digest: &mut chia_sha2::Sha256) { #(self.#fnames.update_digest(digest);)* } fn stream(&self, out: &mut Vec) -> #crate_name::chia_error::Result<()> { @@ -221,7 +221,7 @@ pub fn chia_streamable_macro(input: TokenStream) -> TokenStream { } else if !findices.is_empty() { let ret = quote! { impl #crate_name::Streamable for #ident { - fn update_digest(&self, digest: &mut clvmr::sha2::Sha256) { + fn update_digest(&self, digest: &mut chia_sha2::Sha256) { #(self.#findices.update_digest(digest);)* } fn stream(&self, out: &mut Vec) -> #crate_name::chia_error::Result<()> { @@ -238,7 +238,7 @@ pub fn chia_streamable_macro(input: TokenStream) -> TokenStream { // this is an empty type (Unit) let ret = quote! { impl #crate_name::Streamable for #ident { - fn update_digest(&self, _digest: &mut clvmr::sha2::Sha256) {} + fn update_digest(&self, _digest: &mut chia_sha2::Sha256) {} fn stream(&self, _out: &mut Vec) -> #crate_name::chia_error::Result<()> { Ok(()) } diff --git a/crates/clvm-traits/Cargo.toml b/crates/clvm-traits/Cargo.toml index e37ee88a9..e56887f8f 100644 --- a/crates/clvm-traits/Cargo.toml +++ b/crates/clvm-traits/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clvm-traits" -version = "0.13.0" +version = "0.14.1" edition = "2021" license = "Apache-2.0" description = "Traits for encoding and decoding CLVM objects." diff --git a/crates/clvm-utils/Cargo.toml b/crates/clvm-utils/Cargo.toml index 71f11dc6c..014a82e9c 100644 --- a/crates/clvm-utils/Cargo.toml +++ b/crates/clvm-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "clvm-utils" -version = "0.13.0" +version = "0.14.1" edition = "2021" license = "Apache-2.0" description = "Utility functions for processing clvm programs and structures" @@ -12,6 +12,7 @@ repository = "https://github.com/Chia-Network/chia_rs" workspace = true [dependencies] +chia-sha2 = { workspace = true } clvmr = { workspace = true } clvm-traits = { workspace = true } hex = { workspace = true } diff --git a/crates/clvm-utils/fuzz/fuzz_targets/curry.rs b/crates/clvm-utils/fuzz/fuzz_targets/curry.rs index d8b198830..877a660dd 100644 --- a/crates/clvm-utils/fuzz/fuzz_targets/curry.rs +++ b/crates/clvm-utils/fuzz/fuzz_targets/curry.rs @@ -2,9 +2,9 @@ use clvm_traits::{FromClvm, ToClvm}; use libfuzzer_sys::fuzz_target; +use chia_fuzz::{make_tree, BitCursor}; use clvm_utils::CurriedProgram; use clvmr::allocator::{Allocator, NodePtr}; -use fuzzing_utils::{make_tree, BitCursor}; fuzz_target!(|data: &[u8]| { let mut a = Allocator::new(); diff --git a/crates/clvm-utils/fuzz/fuzz_targets/tree-hash.rs b/crates/clvm-utils/fuzz/fuzz_targets/tree-hash.rs index 74f8e20cd..724957e06 100644 --- a/crates/clvm-utils/fuzz/fuzz_targets/tree-hash.rs +++ b/crates/clvm-utils/fuzz/fuzz_targets/tree-hash.rs @@ -1,9 +1,9 @@ #![no_main] use libfuzzer_sys::fuzz_target; +use chia_fuzz::{make_tree, BitCursor}; use clvm_utils::{tree_hash, tree_hash_cached, TreeHash}; use clvmr::{Allocator, NodePtr}; -use fuzzing_utils::{make_tree, BitCursor}; use std::collections::{HashMap, HashSet}; use clvmr::serde::{node_from_bytes_backrefs_record, node_to_bytes_backrefs}; diff --git a/crates/clvm-utils/src/tree_hash.rs b/crates/clvm-utils/src/tree_hash.rs index df9e12038..2f57312be 100644 --- a/crates/clvm-utils/src/tree_hash.rs +++ b/crates/clvm-utils/src/tree_hash.rs @@ -1,6 +1,6 @@ +use chia_sha2::Sha256; use clvmr::allocator::{Allocator, NodePtr, SExp}; use clvmr::serde::node_from_bytes_backrefs_record; -use clvmr::sha2::Sha256; use std::collections::{HashMap, HashSet}; use std::ops::Deref; use std::{fmt, io}; diff --git a/generator-tests/infinity-g1.txt b/generator-tests/infinity-g1.txt index f047b85ed..15c494f40 100644 --- a/generator-tests/infinity-g1.txt +++ b/generator-tests/infinity-g1.txt @@ -1,8 +1,2 @@ ff01ffffffa00101010101010101010101010101010101010101010101010101010101010101ffff01ffff2bffb0c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff86666f6f6261728080ff7bff80808080 -SPENDS: -- coin id: 10d6c244183579e7704ea71e862098f15d28d63fb63c6a54779d1fe901ca48b1 ph: 99d9c5fd60cc6d5bca3390783d3489cd744139f7f143191ea911de3a22b50907 -cost: 2552512 -removal_amount: 123 -addition_amount: 0 -STRICT: FAILED: 10 diff --git a/mypy.ini b/mypy.ini index 5b5cedc9a..9a3de1aa3 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,4 +1,10 @@ [mypy] +[mypy-blspy.*] +ignore_missing_imports = True + +[mypy-clvm.*] +ignore_missing_imports = True + [mypy-colorama.*] ignore_missing_imports = True diff --git a/src/lib.rs b/src/lib.rs index 808dde2ee..45370ba82 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,10 @@ pub use chia_bls as bls; pub use chia_client as client; pub use chia_consensus as consensus; +pub use chia_datalayer as datalayer; pub use chia_protocol as protocol; pub use chia_puzzles as puzzles; +pub use chia_sha2 as sha2; pub use chia_ssl as ssl; pub use chia_traits as traits; pub use clvm_traits; diff --git a/tests/test_block_record_fidelity.py b/tests/test_block_record_fidelity.py index c357008ce..ec1b3afad 100644 --- a/tests/test_block_record_fidelity.py +++ b/tests/test_block_record_fidelity.py @@ -5,9 +5,8 @@ from chia_rs import BlockRecord, ClassgroupElement from chia_rs.sized_bytes import bytes32, bytes100 from chia_rs.sized_ints import uint32, uint64, uint8, uint128 -from chia.consensus.block_record import BlockRecord as PyBlockRecord from random import Random -from chia.consensus.default_constants import DEFAULT_CONSTANTS +from run_gen import DEFAULT_CONSTANTS def get_classgroup_element(rng: Random) -> ClassgroupElement: @@ -130,34 +129,3 @@ def wrap_call(expr: str, br: Any) -> str: return f"V:{ret}" except Exception as e: return f"E:{e}" - - -def test_block_record() -> None: - rng = Random() - seed = int(time.time()) - print(f"seed: {seed}") - rng.seed(seed) - - for i in range(500000): - br = get_block_record(rng) - serialized = bytes(br) - py_identity = PyBlockRecord.from_bytes(serialized) - - assert bytes(py_identity) == serialized - assert f"{type(br)}" != f"{type(py_identity)}" - - for test_call in [ - "ip_iters", - "sp_total_iters", - "sp_iters", - "ip_sub_slot_total_iters", - "sp_sub_slot_total_iters", - ]: - rust_ret = wrap_call(f"br.{test_call}(DEFAULT_CONSTANTS)", br) - py_ret = wrap_call(f"br.{test_call}(DEFAULT_CONSTANTS)", py_identity) - - assert rust_ret == py_ret - - if (i & 0x3FF) == 0: - sys.stdout.write(f" {i} \r") - sys.stdout.flush() diff --git a/tests/test_blscache.py b/tests/test_blscache.py index 018d539de..35fda7619 100644 --- a/tests/test_blscache.py +++ b/tests/test_blscache.py @@ -18,7 +18,6 @@ from chia.util.hash import std_hash from chia.util.lru_cache import LRUCache from chia.types.blockchain_format.program import Program as ChiaProgram -from chia.util import cached_bls as cached_bls_old import pytest @@ -167,17 +166,12 @@ def test_cached_bls(): # Verify with empty cache and populate it assert cached_bls.aggregate_verify(pks_half, msgs_half, agg_sig_half) - assert cached_bls_old.aggregate_verify( - pks_half_bytes, msgs_half, agg_sig_half, True - ) # Verify with partial cache hit assert cached_bls.aggregate_verify(pks, msgs, agg_sig) - assert cached_bls_old.aggregate_verify(pks_bytes, msgs, agg_sig, True) # Verify with full cache hit assert cached_bls.aggregate_verify(pks, msgs, agg_sig) - assert cached_bls_old.aggregate_verify(pks_bytes, msgs, agg_sig) # Use a small cache which can not accommodate all pairings bls_cache = BLSCache(n_keys // 2) @@ -185,19 +179,12 @@ def test_cached_bls(): # Verify signatures and cache pairings one at a time for pk, msg, sig in zip(pks_half, msgs_half, sigs_half): assert bls_cache.aggregate_verify([pk], [msg], sig) - assert cached_bls_old.aggregate_verify( - [bytes(pk)], [msg], sig, True, local_cache - ) # Verify the same messages with aggregated signature (full cache hit) assert bls_cache.aggregate_verify(pks_half, msgs_half, agg_sig_half) - assert cached_bls_old.aggregate_verify( - pks_half_bytes, msgs_half, agg_sig_half, False, local_cache - ) # Verify more messages (partial cache hit) assert bls_cache.aggregate_verify(pks, msgs, agg_sig) - assert cached_bls_old.aggregate_verify(pks_bytes, msgs, agg_sig, False, local_cache) def test_cached_bls_flattening(): @@ -215,10 +202,9 @@ def test_cached_bls_flattening(): gts = [pk.pair(AugSchemeMPL.g2_from_message(bytes(pk) + b"foobar")) for pk in pks] for key, value in cached_bls.items(): assert isinstance(key, bytes) - assert isinstance(value, bytes) - reconstructed = GTElement.from_bytes(value) - assert reconstructed in gts - gts.remove(reconstructed) + assert isinstance(value, GTElement) + assert value in gts + gts.remove(value) cache_copy = BLSCache() cache_copy.update(cached_bls.items()) @@ -227,10 +213,9 @@ def test_cached_bls_flattening(): gts = [pk.pair(AugSchemeMPL.g2_from_message(bytes(pk) + b"foobar")) for pk in pks] for key, value in cache_copy.items(): assert isinstance(key, bytes) - assert isinstance(value, bytes) - reconstructed = GTElement.from_bytes(value) - assert reconstructed in gts - gts.remove(reconstructed) + assert isinstance(value, GTElement) + assert value in gts + gts.remove(value) def test_cached_bls_repeat_pk(): @@ -250,14 +235,12 @@ def test_cached_bls_repeat_pk(): assert AugSchemeMPL.aggregate_verify([pk for pk in pks], msgs, agg_sig) assert cached_bls.aggregate_verify(pks, msgs, agg_sig) - assert cached_bls_old.aggregate_verify(pks_bytes, msgs, agg_sig, True) def test_empty_sig(): sig = AugSchemeMPL.aggregate([]) cached_bls = BLSCache() assert cached_bls.aggregate_verify([], [], sig) - assert cached_bls_old.aggregate_verify([], [], sig) def test_bad_cache_size(): diff --git a/tests/test_spend_bundle.py b/tests/test_spend_bundle.py index 220180af7..5975b12b2 100644 --- a/tests/test_spend_bundle.py +++ b/tests/test_spend_bundle.py @@ -1,5 +1,4 @@ from chia_rs import SpendBundle -from chia.types.spend_bundle import SpendBundle as PySpendBundle import pytest from typing import Type @@ -189,7 +188,7 @@ amount: 1232500000000 }]" -@pytest.mark.parametrize("ty", [SpendBundle, PySpendBundle]) +@pytest.mark.parametrize("ty", [SpendBundle]) @pytest.mark.parametrize( "input_file, expected_add, expected_rem", [ @@ -211,3 +210,35 @@ def test_spend_bundle( rem = f"{removals}" assert rem == expected_rem + + +class NewAndImprovedSpendBundle(SpendBundle): + test_bool = True + + def new_function(self) -> bool: + return self.test_bool + + +def test_derive_class(): + # Test if aggregate() supports class inheritance + test = SpendBundle.aggregate([]) + assert isinstance(test, SpendBundle) + test = NewAndImprovedSpendBundle.aggregate([]) + assert isinstance(test, NewAndImprovedSpendBundle) + assert test.test_bool + assert test.new_function() + + # Test if the Streamable macro functions support class inheritance + obj_bytes = bytes(test) + test = NewAndImprovedSpendBundle.from_bytes(obj_bytes) + assert isinstance(test, NewAndImprovedSpendBundle) + assert test.test_bool + assert test.new_function() + + obj_json = test.to_json_dict() + test = NewAndImprovedSpendBundle.from_json_dict(obj_json) + assert isinstance(test, NewAndImprovedSpendBundle) + assert test.test_bool + assert test.new_function() + + test = NewAndImprovedSpendBundle.parse_rust(obj_bytes) diff --git a/wheel/Cargo.toml b/wheel/Cargo.toml index 7f166cdea..e40b6134a 100644 --- a/wheel/Cargo.toml +++ b/wheel/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "chia_rs" -version = "0.13.0" +version = "0.14.1" authors = ["Richard Kiss "] edition = "2021" license = "Apache-2.0" +license-file = "../LICENSE" description = "Code useful for implementing chia consensus." homepage = "https://github.com/Chia-Network/chia_rs" repository = "https://github.com/Chia-Network/chia_rs" @@ -23,14 +24,9 @@ python-source = "python" [dependencies] clvmr = { workspace = true } hex = { workspace = true } - pyo3 = { workspace = true, features = ["multiple-pymethods"] } chia-consensus = { workspace = true, features = ["py-bindings"] } chia-bls = { workspace = true, features = ["py-bindings"] } chia-datalayer = { workspace = true, features = ["py-bindings"] } chia-protocol = { workspace = true, features = ["py-bindings"] } -chia-traits = { workspace = true, features = ["py-bindings"] } -clvm-traits = { workspace = true, features = ["derive", "py-bindings"] } clvm-utils = { workspace = true } -chia_py_streamable_macro = { workspace = true } -chia_streamable_macro = { workspace = true } diff --git a/wheel/generate_type_stubs.py b/wheel/generate_type_stubs.py index 670f81f80..3f9f52e2b 100644 --- a/wheel/generate_type_stubs.py +++ b/wheel/generate_type_stubs.py @@ -32,6 +32,8 @@ def add_indent(x: str): all_replace_parameters = [] for m in members: replace_param_name, replace_type = m.split(":") + if replace_param_name.startswith("a") and replace_param_name[1:].isnumeric(): + continue all_replace_parameters.append( f"{replace_param_name}: Union[{replace_type}, _Unspec] = _Unspec()" ) @@ -39,30 +41,35 @@ def add_indent(x: str): if extra is not None: members.extend(extra) + # TODO: could theoretically be detected from the use of #[streamable(subclass)] + inheritable = name in ["SpendBundle"] + + # TODO: is __richcmp__ ever actually present? + # def __richcmp__(self) -> Any: ... file.write( f""" +{"" if inheritable else "@final"} class {name}:{"".join(map(add_indent, members))} def __init__( self{init_args} ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> {name}: ... + def __deepcopy__(self, memo: object) -> {name}: ... def __copy__(self) -> {name}: ... - @staticmethod - def from_bytes(bytes) -> {name}: ... - @staticmethod - def from_bytes_unchecked(bytes) -> {name}: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[{name}, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> {name}: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... """ ) @@ -207,7 +214,7 @@ def parse_rust_source(filename: str, upper_case: bool) -> List[Tuple[str, List[s "Program": [ "def get_tree_hash(self) -> bytes32: ...", "@staticmethod\n def default() -> Program: ...", - "@staticmethod\n def fromhex(hex) -> Program: ...", + "@staticmethod\n def fromhex(h: str) -> Program: ...", "def run_mempool_with_cost(self, max_cost: int, args: object) -> Tuple[int, ChiaProgram]: ...", "def run_with_cost(self, max_cost: int, args: object) -> Tuple[int, ChiaProgram]: ...", "def _run(self, max_cost: int, flags: int, args: object) -> Tuple[int, ChiaProgram]: ...", @@ -217,7 +224,7 @@ def parse_rust_source(filename: str, upper_case: bool) -> List[Tuple[str, List[s "def uncurry(self) -> Tuple[ChiaProgram, ChiaProgram]: ...", ], "SpendBundle": [ - "@staticmethod\n def aggregate(sbs: List[SpendBundle]) -> SpendBundle: ...", + "@classmethod\n def aggregate(cls, spend_bundles: List[SpendBundle]) -> Self: ...", "def name(self) -> bytes32: ...", "def removals(self) -> List[Coin]: ...", "def additions(self) -> List[Coin]: ...", @@ -254,9 +261,10 @@ def parse_rust_source(filename: str, upper_case: bool) -> List[Tuple[str, List[s # this file is generated by generate_type_stubs.py # -from typing import List, Optional, Sequence, Tuple, Union, Dict, Any, ClassVar +from typing import List, Optional, Sequence, Tuple, Union, Dict, Any, ClassVar, final from .sized_bytes import bytes32, bytes100 from .sized_ints import uint8, uint16, uint32, uint64, uint128, int8, int16, int32, int64 +from typing_extensions import Self from chia.types.blockchain_format.program import Program as ChiaProgram ReadableBuffer = Union[bytes, bytearray, memoryview] @@ -267,27 +275,23 @@ class _Unspec: def solution_generator(spends: Sequence[Tuple[Coin, bytes, bytes]]) -> bytes: ... def solution_generator_backrefs(spends: Sequence[Tuple[Coin, bytes, bytes]]) -> bytes: ... -def compute_merkle_set_root(items: Sequence[bytes]) -> bytes: ... +def compute_merkle_set_root(values: Sequence[bytes]) -> bytes: ... def supports_fast_forward(spend: CoinSpend) -> bool : ... def fast_forward_singleton(spend: CoinSpend, new_coin: Coin, new_parent: Coin) -> bytes: ... def run_block_generator( - program: ReadableBuffer, args: List[ReadableBuffer], max_cost: int, flags: int, constants: ConsensusConstants + program: ReadableBuffer, block_refs: List[ReadableBuffer], max_cost: int, flags: int, constants: ConsensusConstants ) -> Tuple[Optional[int], Optional[SpendBundleConditions]]: ... def run_block_generator2( - program: ReadableBuffer, args: List[ReadableBuffer], max_cost: int, flags: int, constants: ConsensusConstants + program: ReadableBuffer, block_refs: List[ReadableBuffer], max_cost: int, flags: int, constants: ConsensusConstants ) -> Tuple[Optional[int], Optional[SpendBundleConditions]]: ... def run_puzzle( puzzle: bytes, solution: bytes, parent_id: bytes32, amount: int, max_cost: int, flags: int, constants: ConsensusConstants ) -> SpendBundleConditions: ... -def deserialize_proof( - proof: bytes -) -> MerkleSet: ... - def confirm_included_already_hashed( root: bytes32, item: bytes32, @@ -323,12 +327,7 @@ def get_flags_for_height_and_constants( NO_UNKNOWN_CONDS: int = ... STRICT_ARGS_COUNT: int = ... LIMIT_HEAP: int = ... -DISALLOW_INFINITY_G1: int = ... MEMPOOL_MODE: int = ... -ENABLE_BLS_OPS: int = ... -ENABLE_SECP_OPS: int = ... -ENABLE_BLS_OPS_OUTSIDE_GUARD: int = ... -ENABLE_FIXED_DIV: int = ... ALLOW_BACKREFS: int = ... ELIGIBLE_FOR_DEDUP: int = ... @@ -340,22 +339,25 @@ def run_chia_program( program: bytes, args: bytes, max_cost: int, flags: int ) -> Tuple[int, LazyNode]: ... +@final class LazyNode: pair: Optional[Tuple[LazyNode, LazyNode]] atom: Optional[bytes] def serialized_length(program: ReadableBuffer) -> int: ... -def tree_hash(program: ReadableBuffer) -> bytes32: ... +def tree_hash(blob: ReadableBuffer) -> bytes32: ... def get_puzzle_and_solution_for_coin(program: ReadableBuffer, args: ReadableBuffer, max_cost: int, find_parent: bytes32, find_amount: int, find_ph: bytes32, flags: int) -> Tuple[bytes, bytes]: ... -def get_puzzle_and_solution_for_coin2(program: Program, block_refs: List[ReadableBuffer], max_cost: int, find_coin: Coin, flags: int) -> Tuple[Program, Program]: ... +def get_puzzle_and_solution_for_coin2(generator: Program, block_refs: List[ReadableBuffer], max_cost: int, find_coin: Coin, flags: int) -> Tuple[Program, Program]: ... +@final class BLSCache: def __init__(self, cache_size: Optional[int] = 50000) -> None: ... def len(self) -> int: ... def aggregate_verify(self, pks: List[G1Element], msgs: List[bytes], sig: G2Element) -> bool: ... - def items(self) -> List[Tuple[bytes, bytes]]: ... - def update(self, other: List[Tuple[bytes, bytes]]) -> None: ... + def items(self) -> List[Tuple[bytes, GTElement]]: ... + def update(self, other: Sequence[Tuple[bytes, GTElement]]) -> None: ... +@final class AugSchemeMPL: @staticmethod def sign(pk: PrivateKey, msg: bytes, prepend_pk: Optional[G1Element] = None) -> G2Element: ... @@ -370,9 +372,9 @@ def key_gen(seed: bytes) -> PrivateKey: ... @staticmethod def g2_from_message(msg: bytes) -> G2Element: ... @staticmethod - def derive_child_sk(pk: PrivateKey, index: int) -> PrivateKey: ... + def derive_child_sk(sk: PrivateKey, index: int) -> PrivateKey: ... @staticmethod - def derive_child_sk_unhardened(pk: PrivateKey, index: int) -> PrivateKey: ... + def derive_child_sk_unhardened(sk: PrivateKey, index: int) -> PrivateKey: ... @staticmethod def derive_child_pk_unhardened(pk: G1Element, index: int) -> G1Element: ... @@ -385,9 +387,10 @@ def __init__( def insert(self, key: uint64, value: bytes32) -> None: ... def __len__(self) -> int: ... +@final class MerkleSet: def get_root(self) -> bytes32: ... - def is_included_already_hashed(self, to_check: bytes) -> Tuple[bool, bytes]: ... + def is_included_already_hashed(self, included_leaf: bytes32) -> Tuple[bool, bytes]: ... def __init__( self, leafs: List[bytes32], @@ -410,7 +413,7 @@ def __init__( "def __str__(self) -> str: ...", "def __add__(self, other: G1Element) -> G1Element: ...", "def __iadd__(self, other: G1Element) -> G1Element: ...", - "def derive_unhardened(self, int) -> G1Element: ...", + "def derive_unhardened(self, idx: int) -> G1Element: ...", ], ) print_class( @@ -449,10 +452,10 @@ def __init__( "def get_g1(self) -> G1Element: ...", "def __str__(self) -> str: ...", "def public_key(self) -> G1Element: ...", - "def derive_hardened(self, int) -> PrivateKey: ...", - "def derive_unhardened(self, int) -> PrivateKey: ...", + "def derive_hardened(self, idx: int) -> PrivateKey: ...", + "def derive_unhardened(self, idx: int) -> PrivateKey: ...", "@staticmethod", - "def from_seed(bytes) -> PrivateKey: ...", + "def from_seed(seed: bytes) -> PrivateKey: ...", ], ) diff --git a/wheel/py.typed b/wheel/py.typed deleted file mode 100644 index e69de29bb..000000000 diff --git a/wheel/pyproject.toml b/wheel/pyproject.toml index cea949f5f..b051c326d 100644 --- a/wheel/pyproject.toml +++ b/wheel/pyproject.toml @@ -6,3 +6,7 @@ build-backend = "maturin" bindings = "pyo3" features = ["pyo3/extension-module"] python-source = "python" + +[project] +name = "chia_rs" +dependencies = ["typing_extensions"] diff --git a/wheel/python/chia_rs/chia_rs.pyi b/wheel/python/chia_rs/chia_rs.pyi index 9586ba5ff..f94eaf5f2 100644 --- a/wheel/python/chia_rs/chia_rs.pyi +++ b/wheel/python/chia_rs/chia_rs.pyi @@ -3,9 +3,10 @@ # this file is generated by generate_type_stubs.py # -from typing import List, Optional, Sequence, Tuple, Union, Dict, Any, ClassVar +from typing import List, Optional, Sequence, Tuple, Union, Dict, Any, ClassVar, final from .sized_bytes import bytes32, bytes100 from .sized_ints import uint8, uint16, uint32, uint64, uint128, int8, int16, int32, int64 +from typing_extensions import Self from chia.types.blockchain_format.program import Program as ChiaProgram ReadableBuffer = Union[bytes, bytearray, memoryview] @@ -16,27 +17,23 @@ class _Unspec: def solution_generator(spends: Sequence[Tuple[Coin, bytes, bytes]]) -> bytes: ... def solution_generator_backrefs(spends: Sequence[Tuple[Coin, bytes, bytes]]) -> bytes: ... -def compute_merkle_set_root(items: Sequence[bytes]) -> bytes: ... +def compute_merkle_set_root(values: Sequence[bytes]) -> bytes: ... def supports_fast_forward(spend: CoinSpend) -> bool : ... def fast_forward_singleton(spend: CoinSpend, new_coin: Coin, new_parent: Coin) -> bytes: ... def run_block_generator( - program: ReadableBuffer, args: List[ReadableBuffer], max_cost: int, flags: int, constants: ConsensusConstants + program: ReadableBuffer, block_refs: List[ReadableBuffer], max_cost: int, flags: int, constants: ConsensusConstants ) -> Tuple[Optional[int], Optional[SpendBundleConditions]]: ... def run_block_generator2( - program: ReadableBuffer, args: List[ReadableBuffer], max_cost: int, flags: int, constants: ConsensusConstants + program: ReadableBuffer, block_refs: List[ReadableBuffer], max_cost: int, flags: int, constants: ConsensusConstants ) -> Tuple[Optional[int], Optional[SpendBundleConditions]]: ... def run_puzzle( puzzle: bytes, solution: bytes, parent_id: bytes32, amount: int, max_cost: int, flags: int, constants: ConsensusConstants ) -> SpendBundleConditions: ... -def deserialize_proof( - proof: bytes -) -> MerkleSet: ... - def confirm_included_already_hashed( root: bytes32, item: bytes32, @@ -72,12 +69,7 @@ def get_flags_for_height_and_constants( NO_UNKNOWN_CONDS: int = ... STRICT_ARGS_COUNT: int = ... LIMIT_HEAP: int = ... -DISALLOW_INFINITY_G1: int = ... MEMPOOL_MODE: int = ... -ENABLE_BLS_OPS: int = ... -ENABLE_SECP_OPS: int = ... -ENABLE_BLS_OPS_OUTSIDE_GUARD: int = ... -ENABLE_FIXED_DIV: int = ... ALLOW_BACKREFS: int = ... ELIGIBLE_FOR_DEDUP: int = ... @@ -89,22 +81,25 @@ def run_chia_program( program: bytes, args: bytes, max_cost: int, flags: int ) -> Tuple[int, LazyNode]: ... +@final class LazyNode: pair: Optional[Tuple[LazyNode, LazyNode]] atom: Optional[bytes] def serialized_length(program: ReadableBuffer) -> int: ... -def tree_hash(program: ReadableBuffer) -> bytes32: ... +def tree_hash(blob: ReadableBuffer) -> bytes32: ... def get_puzzle_and_solution_for_coin(program: ReadableBuffer, args: ReadableBuffer, max_cost: int, find_parent: bytes32, find_amount: int, find_ph: bytes32, flags: int) -> Tuple[bytes, bytes]: ... -def get_puzzle_and_solution_for_coin2(program: Program, block_refs: List[ReadableBuffer], max_cost: int, find_coin: Coin, flags: int) -> Tuple[Program, Program]: ... +def get_puzzle_and_solution_for_coin2(generator: Program, block_refs: List[ReadableBuffer], max_cost: int, find_coin: Coin, flags: int) -> Tuple[Program, Program]: ... +@final class BLSCache: def __init__(self, cache_size: Optional[int] = 50000) -> None: ... def len(self) -> int: ... def aggregate_verify(self, pks: List[G1Element], msgs: List[bytes], sig: G2Element) -> bool: ... - def items(self) -> List[Tuple[bytes, bytes]]: ... - def update(self, other: List[Tuple[bytes, bytes]]) -> None: ... + def items(self) -> List[Tuple[bytes, GTElement]]: ... + def update(self, other: Sequence[Tuple[bytes, GTElement]]) -> None: ... +@final class AugSchemeMPL: @staticmethod def sign(pk: PrivateKey, msg: bytes, prepend_pk: Optional[G1Element] = None) -> G2Element: ... @@ -119,9 +114,9 @@ class AugSchemeMPL: @staticmethod def g2_from_message(msg: bytes) -> G2Element: ... @staticmethod - def derive_child_sk(pk: PrivateKey, index: int) -> PrivateKey: ... + def derive_child_sk(sk: PrivateKey, index: int) -> PrivateKey: ... @staticmethod - def derive_child_sk_unhardened(pk: PrivateKey, index: int) -> PrivateKey: ... + def derive_child_sk_unhardened(sk: PrivateKey, index: int) -> PrivateKey: ... @staticmethod def derive_child_pk_unhardened(pk: G1Element, index: int) -> G1Element: ... @@ -134,14 +129,16 @@ class MerkleBlob: def insert(self, key: uint64, value: bytes32) -> None: ... def __len__(self) -> int: ... +@final class MerkleSet: def get_root(self) -> bytes32: ... - def is_included_already_hashed(self, to_check: bytes) -> Tuple[bool, bytes]: ... + def is_included_already_hashed(self, included_leaf: bytes32) -> Tuple[bool, bytes]: ... def __init__( self, leafs: List[bytes32], ) -> None: ... +@final class G1Element: SIZE: ClassVar[int] = ... def __new__(cls) -> G1Element: ... @@ -153,29 +150,29 @@ class G1Element: def __str__(self) -> str: ... def __add__(self, other: G1Element) -> G1Element: ... def __iadd__(self, other: G1Element) -> G1Element: ... - def derive_unhardened(self, int) -> G1Element: ... + def derive_unhardened(self, idx: int) -> G1Element: ... def __init__( self ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> G1Element: ... + def __deepcopy__(self, memo: object) -> G1Element: ... def __copy__(self) -> G1Element: ... - @staticmethod - def from_bytes(bytes) -> G1Element: ... - @staticmethod - def from_bytes_unchecked(bytes) -> G1Element: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[G1Element, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> G1Element: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... +@final class G2Element: SIZE: ClassVar[int] = ... def __new__(cls) -> G2Element: ... @@ -190,23 +187,23 @@ class G2Element: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> G2Element: ... + def __deepcopy__(self, memo: object) -> G2Element: ... def __copy__(self) -> G2Element: ... - @staticmethod - def from_bytes(bytes) -> G2Element: ... - @staticmethod - def from_bytes_unchecked(bytes) -> G2Element: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[G2Element, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> G2Element: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... +@final class GTElement: SIZE: ClassVar[int] = ... def __str__(self) -> str: ... @@ -217,55 +214,55 @@ class GTElement: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> GTElement: ... + def __deepcopy__(self, memo: object) -> GTElement: ... def __copy__(self) -> GTElement: ... - @staticmethod - def from_bytes(bytes) -> GTElement: ... - @staticmethod - def from_bytes_unchecked(bytes) -> GTElement: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[GTElement, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> GTElement: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... +@final class PrivateKey: PRIVATE_KEY_SIZE: ClassVar[int] = ... def sign(self, msg: bytes, final_pk: Optional[G1Element] = None) -> G2Element: ... def get_g1(self) -> G1Element: ... def __str__(self) -> str: ... def public_key(self) -> G1Element: ... - def derive_hardened(self, int) -> PrivateKey: ... - def derive_unhardened(self, int) -> PrivateKey: ... + def derive_hardened(self, idx: int) -> PrivateKey: ... + def derive_unhardened(self, idx: int) -> PrivateKey: ... @staticmethod - def from_seed(bytes) -> PrivateKey: ... + def from_seed(seed: bytes) -> PrivateKey: ... def __init__( self ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> PrivateKey: ... + def __deepcopy__(self, memo: object) -> PrivateKey: ... def __copy__(self) -> PrivateKey: ... - @staticmethod - def from_bytes(bytes) -> PrivateKey: ... - @staticmethod - def from_bytes_unchecked(bytes) -> PrivateKey: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[PrivateKey, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> PrivateKey: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... +@final class SpendConditions: coin_id: bytes parent_id: bytes @@ -310,22 +307,21 @@ class SpendConditions: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> SpendConditions: ... + def __deepcopy__(self, memo: object) -> SpendConditions: ... def __copy__(self) -> SpendConditions: ... - @staticmethod - def from_bytes(bytes) -> SpendConditions: ... - @staticmethod - def from_bytes_unchecked(bytes) -> SpendConditions: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[SpendConditions, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> SpendConditions: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, coin_id: Union[ bytes, _Unspec] = _Unspec(), parent_id: Union[ bytes, _Unspec] = _Unspec(), puzzle_hash: Union[ bytes, _Unspec] = _Unspec(), @@ -346,6 +342,7 @@ class SpendConditions: agg_sig_parent_puzzle: Union[ List[Tuple[G1Element, bytes]], _Unspec] = _Unspec(), flags: Union[ int, _Unspec] = _Unspec()) -> SpendConditions: ... +@final class SpendBundleConditions: spends: List[SpendConditions] reserve_fee: int @@ -372,22 +369,21 @@ class SpendBundleConditions: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> SpendBundleConditions: ... + def __deepcopy__(self, memo: object) -> SpendBundleConditions: ... def __copy__(self) -> SpendBundleConditions: ... - @staticmethod - def from_bytes(bytes) -> SpendBundleConditions: ... - @staticmethod - def from_bytes_unchecked(bytes) -> SpendBundleConditions: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[SpendBundleConditions, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> SpendBundleConditions: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, spends: Union[ List[SpendConditions], _Unspec] = _Unspec(), reserve_fee: Union[ int, _Unspec] = _Unspec(), height_absolute: Union[ int, _Unspec] = _Unspec(), @@ -399,6 +395,7 @@ class SpendBundleConditions: removal_amount: Union[ int, _Unspec] = _Unspec(), addition_amount: Union[ int, _Unspec] = _Unspec()) -> SpendBundleConditions: ... +@final class BlockRecord: header_hash: bytes32 prev_hash: bytes32 @@ -463,22 +460,21 @@ class BlockRecord: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> BlockRecord: ... + def __deepcopy__(self, memo: object) -> BlockRecord: ... def __copy__(self) -> BlockRecord: ... - @staticmethod - def from_bytes(bytes) -> BlockRecord: ... - @staticmethod - def from_bytes_unchecked(bytes) -> BlockRecord: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[BlockRecord, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> BlockRecord: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, header_hash: Union[ bytes32, _Unspec] = _Unspec(), prev_hash: Union[ bytes32, _Unspec] = _Unspec(), height: Union[ uint32, _Unspec] = _Unspec(), @@ -505,6 +501,7 @@ class BlockRecord: finished_reward_slot_hashes: Union[ Optional[List[bytes32]], _Unspec] = _Unspec(), sub_epoch_summary_included: Union[ Optional[SubEpochSummary], _Unspec] = _Unspec()) -> BlockRecord: ... +@final class Message: msg_type: int id: Optional[uint16] @@ -517,26 +514,26 @@ class Message: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> Message: ... + def __deepcopy__(self, memo: object) -> Message: ... def __copy__(self) -> Message: ... - @staticmethod - def from_bytes(bytes) -> Message: ... - @staticmethod - def from_bytes_unchecked(bytes) -> Message: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[Message, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> Message: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, msg_type: Union[ int, _Unspec] = _Unspec(), id: Union[ Optional[uint16], _Unspec] = _Unspec(), data: Union[ bytes, _Unspec] = _Unspec()) -> Message: ... +@final class Handshake: network_id: str protocol_version: str @@ -555,22 +552,21 @@ class Handshake: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> Handshake: ... + def __deepcopy__(self, memo: object) -> Handshake: ... def __copy__(self) -> Handshake: ... - @staticmethod - def from_bytes(bytes) -> Handshake: ... - @staticmethod - def from_bytes_unchecked(bytes) -> Handshake: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[Handshake, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> Handshake: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, network_id: Union[ str, _Unspec] = _Unspec(), protocol_version: Union[ str, _Unspec] = _Unspec(), software_version: Union[ str, _Unspec] = _Unspec(), @@ -578,6 +574,7 @@ class Handshake: node_type: Union[ int, _Unspec] = _Unspec(), capabilities: Union[ List[Tuple[uint16, str]], _Unspec] = _Unspec()) -> Handshake: ... +@final class ClassgroupElement: data: bytes100 @staticmethod @@ -592,24 +589,24 @@ class ClassgroupElement: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> ClassgroupElement: ... + def __deepcopy__(self, memo: object) -> ClassgroupElement: ... def __copy__(self) -> ClassgroupElement: ... - @staticmethod - def from_bytes(bytes) -> ClassgroupElement: ... - @staticmethod - def from_bytes_unchecked(bytes) -> ClassgroupElement: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[ClassgroupElement, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> ClassgroupElement: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, data: Union[ bytes100, _Unspec] = _Unspec()) -> ClassgroupElement: ... +@final class Coin: parent_coin_info: bytes32 puzzle_hash: bytes32 @@ -623,26 +620,26 @@ class Coin: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> Coin: ... + def __deepcopy__(self, memo: object) -> Coin: ... def __copy__(self) -> Coin: ... - @staticmethod - def from_bytes(bytes) -> Coin: ... - @staticmethod - def from_bytes_unchecked(bytes) -> Coin: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[Coin, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> Coin: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, parent_coin_info: Union[ bytes32, _Unspec] = _Unspec(), puzzle_hash: Union[ bytes32, _Unspec] = _Unspec(), amount: Union[ uint64, _Unspec] = _Unspec()) -> Coin: ... +@final class CoinSpend: coin: Coin puzzle_reveal: Program @@ -655,26 +652,26 @@ class CoinSpend: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> CoinSpend: ... + def __deepcopy__(self, memo: object) -> CoinSpend: ... def __copy__(self) -> CoinSpend: ... - @staticmethod - def from_bytes(bytes) -> CoinSpend: ... - @staticmethod - def from_bytes_unchecked(bytes) -> CoinSpend: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[CoinSpend, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> CoinSpend: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, coin: Union[ Coin, _Unspec] = _Unspec(), puzzle_reveal: Union[ Program, _Unspec] = _Unspec(), solution: Union[ Program, _Unspec] = _Unspec()) -> CoinSpend: ... +@final class CoinState: coin: Coin spent_height: Optional[uint32] @@ -687,26 +684,26 @@ class CoinState: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> CoinState: ... + def __deepcopy__(self, memo: object) -> CoinState: ... def __copy__(self) -> CoinState: ... - @staticmethod - def from_bytes(bytes) -> CoinState: ... - @staticmethod - def from_bytes_unchecked(bytes) -> CoinState: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[CoinState, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> CoinState: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, coin: Union[ Coin, _Unspec] = _Unspec(), spent_height: Union[ Optional[uint32], _Unspec] = _Unspec(), created_height: Union[ Optional[uint32], _Unspec] = _Unspec()) -> CoinState: ... +@final class EndOfSubSlotBundle: challenge_chain: ChallengeChainSubSlot infused_challenge_chain: Optional[InfusedChallengeChainSubSlot] @@ -721,27 +718,27 @@ class EndOfSubSlotBundle: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> EndOfSubSlotBundle: ... + def __deepcopy__(self, memo: object) -> EndOfSubSlotBundle: ... def __copy__(self) -> EndOfSubSlotBundle: ... - @staticmethod - def from_bytes(bytes) -> EndOfSubSlotBundle: ... - @staticmethod - def from_bytes_unchecked(bytes) -> EndOfSubSlotBundle: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[EndOfSubSlotBundle, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> EndOfSubSlotBundle: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, challenge_chain: Union[ ChallengeChainSubSlot, _Unspec] = _Unspec(), infused_challenge_chain: Union[ Optional[InfusedChallengeChainSubSlot], _Unspec] = _Unspec(), reward_chain: Union[ RewardChainSubSlot, _Unspec] = _Unspec(), proofs: Union[ SubSlotProofs, _Unspec] = _Unspec()) -> EndOfSubSlotBundle: ... +@final class FeeRate: mojos_per_clvm_cost: uint64 def __init__( @@ -750,24 +747,24 @@ class FeeRate: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> FeeRate: ... + def __deepcopy__(self, memo: object) -> FeeRate: ... def __copy__(self) -> FeeRate: ... - @staticmethod - def from_bytes(bytes) -> FeeRate: ... - @staticmethod - def from_bytes_unchecked(bytes) -> FeeRate: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[FeeRate, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> FeeRate: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, mojos_per_clvm_cost: Union[ uint64, _Unspec] = _Unspec()) -> FeeRate: ... +@final class FeeEstimate: error: Optional[str] time_target: uint64 @@ -780,26 +777,26 @@ class FeeEstimate: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> FeeEstimate: ... + def __deepcopy__(self, memo: object) -> FeeEstimate: ... def __copy__(self) -> FeeEstimate: ... - @staticmethod - def from_bytes(bytes) -> FeeEstimate: ... - @staticmethod - def from_bytes_unchecked(bytes) -> FeeEstimate: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[FeeEstimate, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> FeeEstimate: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, error: Union[ Optional[str], _Unspec] = _Unspec(), time_target: Union[ uint64, _Unspec] = _Unspec(), estimated_fee_rate: Union[ FeeRate, _Unspec] = _Unspec()) -> FeeEstimate: ... +@final class FeeEstimateGroup: error: Optional[str] estimates: List[FeeEstimate] @@ -810,25 +807,25 @@ class FeeEstimateGroup: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> FeeEstimateGroup: ... + def __deepcopy__(self, memo: object) -> FeeEstimateGroup: ... def __copy__(self) -> FeeEstimateGroup: ... - @staticmethod - def from_bytes(bytes) -> FeeEstimateGroup: ... - @staticmethod - def from_bytes_unchecked(bytes) -> FeeEstimateGroup: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[FeeEstimateGroup, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> FeeEstimateGroup: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, error: Union[ Optional[str], _Unspec] = _Unspec(), estimates: Union[ List[FeeEstimate], _Unspec] = _Unspec()) -> FeeEstimateGroup: ... +@final class TransactionsInfo: generator_root: bytes32 generator_refs_root: bytes32 @@ -847,22 +844,21 @@ class TransactionsInfo: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> TransactionsInfo: ... + def __deepcopy__(self, memo: object) -> TransactionsInfo: ... def __copy__(self) -> TransactionsInfo: ... - @staticmethod - def from_bytes(bytes) -> TransactionsInfo: ... - @staticmethod - def from_bytes_unchecked(bytes) -> TransactionsInfo: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[TransactionsInfo, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> TransactionsInfo: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, generator_root: Union[ bytes32, _Unspec] = _Unspec(), generator_refs_root: Union[ bytes32, _Unspec] = _Unspec(), aggregated_signature: Union[ G2Element, _Unspec] = _Unspec(), @@ -870,6 +866,7 @@ class TransactionsInfo: cost: Union[ uint64, _Unspec] = _Unspec(), reward_claims_incorporated: Union[ List[Coin], _Unspec] = _Unspec()) -> TransactionsInfo: ... +@final class FoliageTransactionBlock: prev_transaction_block_hash: bytes32 timestamp: uint64 @@ -888,22 +885,21 @@ class FoliageTransactionBlock: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> FoliageTransactionBlock: ... + def __deepcopy__(self, memo: object) -> FoliageTransactionBlock: ... def __copy__(self) -> FoliageTransactionBlock: ... - @staticmethod - def from_bytes(bytes) -> FoliageTransactionBlock: ... - @staticmethod - def from_bytes_unchecked(bytes) -> FoliageTransactionBlock: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[FoliageTransactionBlock, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> FoliageTransactionBlock: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, prev_transaction_block_hash: Union[ bytes32, _Unspec] = _Unspec(), timestamp: Union[ uint64, _Unspec] = _Unspec(), filter_hash: Union[ bytes32, _Unspec] = _Unspec(), @@ -911,6 +907,7 @@ class FoliageTransactionBlock: removals_root: Union[ bytes32, _Unspec] = _Unspec(), transactions_info_hash: Union[ bytes32, _Unspec] = _Unspec()) -> FoliageTransactionBlock: ... +@final class FoliageBlockData: unfinished_reward_block_hash: bytes32 pool_target: PoolTarget @@ -927,28 +924,28 @@ class FoliageBlockData: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> FoliageBlockData: ... + def __deepcopy__(self, memo: object) -> FoliageBlockData: ... def __copy__(self) -> FoliageBlockData: ... - @staticmethod - def from_bytes(bytes) -> FoliageBlockData: ... - @staticmethod - def from_bytes_unchecked(bytes) -> FoliageBlockData: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[FoliageBlockData, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> FoliageBlockData: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, unfinished_reward_block_hash: Union[ bytes32, _Unspec] = _Unspec(), pool_target: Union[ PoolTarget, _Unspec] = _Unspec(), pool_signature: Union[ Optional[G2Element], _Unspec] = _Unspec(), farmer_reward_puzzle_hash: Union[ bytes32, _Unspec] = _Unspec(), extension_data: Union[ bytes32, _Unspec] = _Unspec()) -> FoliageBlockData: ... +@final class Foliage: prev_block_hash: bytes32 reward_block_hash: bytes32 @@ -967,22 +964,21 @@ class Foliage: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> Foliage: ... + def __deepcopy__(self, memo: object) -> Foliage: ... def __copy__(self) -> Foliage: ... - @staticmethod - def from_bytes(bytes) -> Foliage: ... - @staticmethod - def from_bytes_unchecked(bytes) -> Foliage: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[Foliage, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> Foliage: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, prev_block_hash: Union[ bytes32, _Unspec] = _Unspec(), reward_block_hash: Union[ bytes32, _Unspec] = _Unspec(), foliage_block_data: Union[ FoliageBlockData, _Unspec] = _Unspec(), @@ -990,6 +986,7 @@ class Foliage: foliage_transaction_block_hash: Union[ Optional[bytes32], _Unspec] = _Unspec(), foliage_transaction_block_signature: Union[ Optional[G2Element], _Unspec] = _Unspec()) -> Foliage: ... +@final class NewPeak: header_hash: bytes32 height: uint32 @@ -1006,28 +1003,28 @@ class NewPeak: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> NewPeak: ... + def __deepcopy__(self, memo: object) -> NewPeak: ... def __copy__(self) -> NewPeak: ... - @staticmethod - def from_bytes(bytes) -> NewPeak: ... - @staticmethod - def from_bytes_unchecked(bytes) -> NewPeak: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[NewPeak, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> NewPeak: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, header_hash: Union[ bytes32, _Unspec] = _Unspec(), height: Union[ uint32, _Unspec] = _Unspec(), weight: Union[ uint128, _Unspec] = _Unspec(), fork_point_with_previous_peak: Union[ uint32, _Unspec] = _Unspec(), unfinished_reward_block_hash: Union[ bytes32, _Unspec] = _Unspec()) -> NewPeak: ... +@final class NewTransaction: transaction_id: bytes32 cost: uint64 @@ -1040,26 +1037,26 @@ class NewTransaction: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> NewTransaction: ... + def __deepcopy__(self, memo: object) -> NewTransaction: ... def __copy__(self) -> NewTransaction: ... - @staticmethod - def from_bytes(bytes) -> NewTransaction: ... - @staticmethod - def from_bytes_unchecked(bytes) -> NewTransaction: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[NewTransaction, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> NewTransaction: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, transaction_id: Union[ bytes32, _Unspec] = _Unspec(), cost: Union[ uint64, _Unspec] = _Unspec(), fees: Union[ uint64, _Unspec] = _Unspec()) -> NewTransaction: ... +@final class RequestTransaction: transaction_id: bytes32 def __init__( @@ -1068,24 +1065,24 @@ class RequestTransaction: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestTransaction: ... + def __deepcopy__(self, memo: object) -> RequestTransaction: ... def __copy__(self) -> RequestTransaction: ... - @staticmethod - def from_bytes(bytes) -> RequestTransaction: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestTransaction: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestTransaction, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestTransaction: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, transaction_id: Union[ bytes32, _Unspec] = _Unspec()) -> RequestTransaction: ... +@final class RespondTransaction: transaction: SpendBundle def __init__( @@ -1094,24 +1091,24 @@ class RespondTransaction: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondTransaction: ... + def __deepcopy__(self, memo: object) -> RespondTransaction: ... def __copy__(self) -> RespondTransaction: ... - @staticmethod - def from_bytes(bytes) -> RespondTransaction: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondTransaction: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondTransaction, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondTransaction: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, transaction: Union[ SpendBundle, _Unspec] = _Unspec()) -> RespondTransaction: ... +@final class RequestProofOfWeight: total_number_of_blocks: uint32 tip: bytes32 @@ -1122,25 +1119,25 @@ class RequestProofOfWeight: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestProofOfWeight: ... + def __deepcopy__(self, memo: object) -> RequestProofOfWeight: ... def __copy__(self) -> RequestProofOfWeight: ... - @staticmethod - def from_bytes(bytes) -> RequestProofOfWeight: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestProofOfWeight: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestProofOfWeight, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestProofOfWeight: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, total_number_of_blocks: Union[ uint32, _Unspec] = _Unspec(), tip: Union[ bytes32, _Unspec] = _Unspec()) -> RequestProofOfWeight: ... +@final class RespondProofOfWeight: wp: WeightProof tip: bytes32 @@ -1151,25 +1148,25 @@ class RespondProofOfWeight: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondProofOfWeight: ... + def __deepcopy__(self, memo: object) -> RespondProofOfWeight: ... def __copy__(self) -> RespondProofOfWeight: ... - @staticmethod - def from_bytes(bytes) -> RespondProofOfWeight: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondProofOfWeight: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondProofOfWeight, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondProofOfWeight: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, wp: Union[ WeightProof, _Unspec] = _Unspec(), tip: Union[ bytes32, _Unspec] = _Unspec()) -> RespondProofOfWeight: ... +@final class RequestBlock: height: uint32 include_transaction_block: bool @@ -1180,25 +1177,25 @@ class RequestBlock: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestBlock: ... + def __deepcopy__(self, memo: object) -> RequestBlock: ... def __copy__(self) -> RequestBlock: ... - @staticmethod - def from_bytes(bytes) -> RequestBlock: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestBlock: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestBlock, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestBlock: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, height: Union[ uint32, _Unspec] = _Unspec(), include_transaction_block: Union[ bool, _Unspec] = _Unspec()) -> RequestBlock: ... +@final class RejectBlock: height: uint32 def __init__( @@ -1207,24 +1204,24 @@ class RejectBlock: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RejectBlock: ... + def __deepcopy__(self, memo: object) -> RejectBlock: ... def __copy__(self) -> RejectBlock: ... - @staticmethod - def from_bytes(bytes) -> RejectBlock: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RejectBlock: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RejectBlock, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RejectBlock: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, height: Union[ uint32, _Unspec] = _Unspec()) -> RejectBlock: ... +@final class RequestBlocks: start_height: uint32 end_height: uint32 @@ -1237,26 +1234,26 @@ class RequestBlocks: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestBlocks: ... + def __deepcopy__(self, memo: object) -> RequestBlocks: ... def __copy__(self) -> RequestBlocks: ... - @staticmethod - def from_bytes(bytes) -> RequestBlocks: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestBlocks: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestBlocks, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestBlocks: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, start_height: Union[ uint32, _Unspec] = _Unspec(), end_height: Union[ uint32, _Unspec] = _Unspec(), include_transaction_block: Union[ bool, _Unspec] = _Unspec()) -> RequestBlocks: ... +@final class RespondBlocks: start_height: uint32 end_height: uint32 @@ -1269,26 +1266,26 @@ class RespondBlocks: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondBlocks: ... + def __deepcopy__(self, memo: object) -> RespondBlocks: ... def __copy__(self) -> RespondBlocks: ... - @staticmethod - def from_bytes(bytes) -> RespondBlocks: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondBlocks: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondBlocks, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondBlocks: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, start_height: Union[ uint32, _Unspec] = _Unspec(), end_height: Union[ uint32, _Unspec] = _Unspec(), blocks: Union[ List[FullBlock], _Unspec] = _Unspec()) -> RespondBlocks: ... +@final class RejectBlocks: start_height: uint32 end_height: uint32 @@ -1299,25 +1296,25 @@ class RejectBlocks: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RejectBlocks: ... + def __deepcopy__(self, memo: object) -> RejectBlocks: ... def __copy__(self) -> RejectBlocks: ... - @staticmethod - def from_bytes(bytes) -> RejectBlocks: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RejectBlocks: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RejectBlocks, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RejectBlocks: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, start_height: Union[ uint32, _Unspec] = _Unspec(), end_height: Union[ uint32, _Unspec] = _Unspec()) -> RejectBlocks: ... +@final class RespondBlock: block: FullBlock def __init__( @@ -1326,24 +1323,24 @@ class RespondBlock: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondBlock: ... + def __deepcopy__(self, memo: object) -> RespondBlock: ... def __copy__(self) -> RespondBlock: ... - @staticmethod - def from_bytes(bytes) -> RespondBlock: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondBlock: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondBlock, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondBlock: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, block: Union[ FullBlock, _Unspec] = _Unspec()) -> RespondBlock: ... +@final class NewUnfinishedBlock: unfinished_reward_hash: bytes32 def __init__( @@ -1352,24 +1349,24 @@ class NewUnfinishedBlock: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> NewUnfinishedBlock: ... + def __deepcopy__(self, memo: object) -> NewUnfinishedBlock: ... def __copy__(self) -> NewUnfinishedBlock: ... - @staticmethod - def from_bytes(bytes) -> NewUnfinishedBlock: ... - @staticmethod - def from_bytes_unchecked(bytes) -> NewUnfinishedBlock: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[NewUnfinishedBlock, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> NewUnfinishedBlock: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, unfinished_reward_hash: Union[ bytes32, _Unspec] = _Unspec()) -> NewUnfinishedBlock: ... +@final class RequestUnfinishedBlock: unfinished_reward_hash: bytes32 def __init__( @@ -1378,24 +1375,24 @@ class RequestUnfinishedBlock: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestUnfinishedBlock: ... + def __deepcopy__(self, memo: object) -> RequestUnfinishedBlock: ... def __copy__(self) -> RequestUnfinishedBlock: ... - @staticmethod - def from_bytes(bytes) -> RequestUnfinishedBlock: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestUnfinishedBlock: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestUnfinishedBlock, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestUnfinishedBlock: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, unfinished_reward_hash: Union[ bytes32, _Unspec] = _Unspec()) -> RequestUnfinishedBlock: ... +@final class RespondUnfinishedBlock: unfinished_block: UnfinishedBlock def __init__( @@ -1404,24 +1401,24 @@ class RespondUnfinishedBlock: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondUnfinishedBlock: ... + def __deepcopy__(self, memo: object) -> RespondUnfinishedBlock: ... def __copy__(self) -> RespondUnfinishedBlock: ... - @staticmethod - def from_bytes(bytes) -> RespondUnfinishedBlock: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondUnfinishedBlock: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondUnfinishedBlock, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondUnfinishedBlock: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, unfinished_block: Union[ UnfinishedBlock, _Unspec] = _Unspec()) -> RespondUnfinishedBlock: ... +@final class NewSignagePointOrEndOfSubSlot: prev_challenge_hash: Optional[bytes32] challenge_hash: bytes32 @@ -1436,27 +1433,27 @@ class NewSignagePointOrEndOfSubSlot: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> NewSignagePointOrEndOfSubSlot: ... + def __deepcopy__(self, memo: object) -> NewSignagePointOrEndOfSubSlot: ... def __copy__(self) -> NewSignagePointOrEndOfSubSlot: ... - @staticmethod - def from_bytes(bytes) -> NewSignagePointOrEndOfSubSlot: ... - @staticmethod - def from_bytes_unchecked(bytes) -> NewSignagePointOrEndOfSubSlot: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[NewSignagePointOrEndOfSubSlot, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> NewSignagePointOrEndOfSubSlot: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, prev_challenge_hash: Union[ Optional[bytes32], _Unspec] = _Unspec(), challenge_hash: Union[ bytes32, _Unspec] = _Unspec(), index_from_challenge: Union[ uint8, _Unspec] = _Unspec(), last_rc_infusion: Union[ bytes32, _Unspec] = _Unspec()) -> NewSignagePointOrEndOfSubSlot: ... +@final class RequestSignagePointOrEndOfSubSlot: challenge_hash: bytes32 index_from_challenge: uint8 @@ -1469,26 +1466,26 @@ class RequestSignagePointOrEndOfSubSlot: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestSignagePointOrEndOfSubSlot: ... + def __deepcopy__(self, memo: object) -> RequestSignagePointOrEndOfSubSlot: ... def __copy__(self) -> RequestSignagePointOrEndOfSubSlot: ... - @staticmethod - def from_bytes(bytes) -> RequestSignagePointOrEndOfSubSlot: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestSignagePointOrEndOfSubSlot: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestSignagePointOrEndOfSubSlot, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestSignagePointOrEndOfSubSlot: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, challenge_hash: Union[ bytes32, _Unspec] = _Unspec(), index_from_challenge: Union[ uint8, _Unspec] = _Unspec(), last_rc_infusion: Union[ bytes32, _Unspec] = _Unspec()) -> RequestSignagePointOrEndOfSubSlot: ... +@final class RespondSignagePoint: index_from_challenge: uint8 challenge_chain_vdf: VDFInfo @@ -1505,28 +1502,28 @@ class RespondSignagePoint: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondSignagePoint: ... + def __deepcopy__(self, memo: object) -> RespondSignagePoint: ... def __copy__(self) -> RespondSignagePoint: ... - @staticmethod - def from_bytes(bytes) -> RespondSignagePoint: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondSignagePoint: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondSignagePoint, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondSignagePoint: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, index_from_challenge: Union[ uint8, _Unspec] = _Unspec(), challenge_chain_vdf: Union[ VDFInfo, _Unspec] = _Unspec(), challenge_chain_proof: Union[ VDFProof, _Unspec] = _Unspec(), reward_chain_vdf: Union[ VDFInfo, _Unspec] = _Unspec(), reward_chain_proof: Union[ VDFProof, _Unspec] = _Unspec()) -> RespondSignagePoint: ... +@final class RespondEndOfSubSlot: end_of_slot_bundle: EndOfSubSlotBundle def __init__( @@ -1535,24 +1532,24 @@ class RespondEndOfSubSlot: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondEndOfSubSlot: ... + def __deepcopy__(self, memo: object) -> RespondEndOfSubSlot: ... def __copy__(self) -> RespondEndOfSubSlot: ... - @staticmethod - def from_bytes(bytes) -> RespondEndOfSubSlot: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondEndOfSubSlot: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondEndOfSubSlot, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondEndOfSubSlot: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, end_of_slot_bundle: Union[ EndOfSubSlotBundle, _Unspec] = _Unspec()) -> RespondEndOfSubSlot: ... +@final class RequestMempoolTransactions: filter: bytes def __init__( @@ -1561,24 +1558,24 @@ class RequestMempoolTransactions: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestMempoolTransactions: ... + def __deepcopy__(self, memo: object) -> RequestMempoolTransactions: ... def __copy__(self) -> RequestMempoolTransactions: ... - @staticmethod - def from_bytes(bytes) -> RequestMempoolTransactions: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestMempoolTransactions: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestMempoolTransactions, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestMempoolTransactions: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, filter: Union[ bytes, _Unspec] = _Unspec()) -> RequestMempoolTransactions: ... +@final class NewCompactVDF: height: uint32 header_hash: bytes32 @@ -1593,27 +1590,27 @@ class NewCompactVDF: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> NewCompactVDF: ... + def __deepcopy__(self, memo: object) -> NewCompactVDF: ... def __copy__(self) -> NewCompactVDF: ... - @staticmethod - def from_bytes(bytes) -> NewCompactVDF: ... - @staticmethod - def from_bytes_unchecked(bytes) -> NewCompactVDF: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[NewCompactVDF, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> NewCompactVDF: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, height: Union[ uint32, _Unspec] = _Unspec(), header_hash: Union[ bytes32, _Unspec] = _Unspec(), field_vdf: Union[ uint8, _Unspec] = _Unspec(), vdf_info: Union[ VDFInfo, _Unspec] = _Unspec()) -> NewCompactVDF: ... +@final class RequestCompactVDF: height: uint32 header_hash: bytes32 @@ -1628,27 +1625,27 @@ class RequestCompactVDF: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestCompactVDF: ... + def __deepcopy__(self, memo: object) -> RequestCompactVDF: ... def __copy__(self) -> RequestCompactVDF: ... - @staticmethod - def from_bytes(bytes) -> RequestCompactVDF: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestCompactVDF: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestCompactVDF, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestCompactVDF: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, height: Union[ uint32, _Unspec] = _Unspec(), header_hash: Union[ bytes32, _Unspec] = _Unspec(), field_vdf: Union[ uint8, _Unspec] = _Unspec(), vdf_info: Union[ VDFInfo, _Unspec] = _Unspec()) -> RequestCompactVDF: ... +@final class RespondCompactVDF: height: uint32 header_hash: bytes32 @@ -1665,51 +1662,51 @@ class RespondCompactVDF: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondCompactVDF: ... + def __deepcopy__(self, memo: object) -> RespondCompactVDF: ... def __copy__(self) -> RespondCompactVDF: ... - @staticmethod - def from_bytes(bytes) -> RespondCompactVDF: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondCompactVDF: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondCompactVDF, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondCompactVDF: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, height: Union[ uint32, _Unspec] = _Unspec(), header_hash: Union[ bytes32, _Unspec] = _Unspec(), field_vdf: Union[ uint8, _Unspec] = _Unspec(), vdf_info: Union[ VDFInfo, _Unspec] = _Unspec(), vdf_proof: Union[ VDFProof, _Unspec] = _Unspec()) -> RespondCompactVDF: ... +@final class RequestPeers: def __init__( self ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestPeers: ... + def __deepcopy__(self, memo: object) -> RequestPeers: ... def __copy__(self) -> RequestPeers: ... - @staticmethod - def from_bytes(bytes) -> RequestPeers: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestPeers: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestPeers, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestPeers: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... +@final class RespondPeers: peer_list: List[TimestampedPeerInfo] def __init__( @@ -1718,24 +1715,24 @@ class RespondPeers: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondPeers: ... + def __deepcopy__(self, memo: object) -> RespondPeers: ... def __copy__(self) -> RespondPeers: ... - @staticmethod - def from_bytes(bytes) -> RespondPeers: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondPeers: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondPeers, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondPeers: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, peer_list: Union[ List[TimestampedPeerInfo], _Unspec] = _Unspec()) -> RespondPeers: ... +@final class NewUnfinishedBlock2: unfinished_reward_hash: bytes32 foliage_hash: Optional[bytes32] @@ -1746,25 +1743,25 @@ class NewUnfinishedBlock2: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> NewUnfinishedBlock2: ... + def __deepcopy__(self, memo: object) -> NewUnfinishedBlock2: ... def __copy__(self) -> NewUnfinishedBlock2: ... - @staticmethod - def from_bytes(bytes) -> NewUnfinishedBlock2: ... - @staticmethod - def from_bytes_unchecked(bytes) -> NewUnfinishedBlock2: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[NewUnfinishedBlock2, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> NewUnfinishedBlock2: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, unfinished_reward_hash: Union[ bytes32, _Unspec] = _Unspec(), foliage_hash: Union[ Optional[bytes32], _Unspec] = _Unspec()) -> NewUnfinishedBlock2: ... +@final class RequestUnfinishedBlock2: unfinished_reward_hash: bytes32 foliage_hash: Optional[bytes32] @@ -1775,25 +1772,25 @@ class RequestUnfinishedBlock2: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestUnfinishedBlock2: ... + def __deepcopy__(self, memo: object) -> RequestUnfinishedBlock2: ... def __copy__(self) -> RequestUnfinishedBlock2: ... - @staticmethod - def from_bytes(bytes) -> RequestUnfinishedBlock2: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestUnfinishedBlock2: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestUnfinishedBlock2, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestUnfinishedBlock2: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, unfinished_reward_hash: Union[ bytes32, _Unspec] = _Unspec(), foliage_hash: Union[ Optional[bytes32], _Unspec] = _Unspec()) -> RequestUnfinishedBlock2: ... +@final class FullBlock: finished_sub_slots: List[EndOfSubSlotBundle] reward_chain_block: RewardChainBlock @@ -1832,22 +1829,21 @@ class FullBlock: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> FullBlock: ... + def __deepcopy__(self, memo: object) -> FullBlock: ... def __copy__(self) -> FullBlock: ... - @staticmethod - def from_bytes(bytes) -> FullBlock: ... - @staticmethod - def from_bytes_unchecked(bytes) -> FullBlock: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[FullBlock, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> FullBlock: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, finished_sub_slots: Union[ List[EndOfSubSlotBundle], _Unspec] = _Unspec(), reward_chain_block: Union[ RewardChainBlock, _Unspec] = _Unspec(), challenge_chain_sp_proof: Union[ Optional[VDFProof], _Unspec] = _Unspec(), @@ -1861,6 +1857,7 @@ class FullBlock: transactions_generator: Union[ Optional[Program], _Unspec] = _Unspec(), transactions_generator_ref_list: Union[ List[uint32], _Unspec] = _Unspec()) -> FullBlock: ... +@final class HeaderBlock: finished_sub_slots: List[EndOfSubSlotBundle] reward_chain_block: RewardChainBlock @@ -1898,22 +1895,21 @@ class HeaderBlock: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> HeaderBlock: ... + def __deepcopy__(self, memo: object) -> HeaderBlock: ... def __copy__(self) -> HeaderBlock: ... - @staticmethod - def from_bytes(bytes) -> HeaderBlock: ... - @staticmethod - def from_bytes_unchecked(bytes) -> HeaderBlock: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[HeaderBlock, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> HeaderBlock: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, finished_sub_slots: Union[ List[EndOfSubSlotBundle], _Unspec] = _Unspec(), reward_chain_block: Union[ RewardChainBlock, _Unspec] = _Unspec(), challenge_chain_sp_proof: Union[ Optional[VDFProof], _Unspec] = _Unspec(), @@ -1926,6 +1922,7 @@ class HeaderBlock: transactions_filter: Union[ bytes, _Unspec] = _Unspec(), transactions_info: Union[ Optional[TransactionsInfo], _Unspec] = _Unspec()) -> HeaderBlock: ... +@final class TimestampedPeerInfo: host: str port: uint16 @@ -1938,26 +1935,26 @@ class TimestampedPeerInfo: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> TimestampedPeerInfo: ... + def __deepcopy__(self, memo: object) -> TimestampedPeerInfo: ... def __copy__(self) -> TimestampedPeerInfo: ... - @staticmethod - def from_bytes(bytes) -> TimestampedPeerInfo: ... - @staticmethod - def from_bytes_unchecked(bytes) -> TimestampedPeerInfo: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[TimestampedPeerInfo, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> TimestampedPeerInfo: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, host: Union[ str, _Unspec] = _Unspec(), port: Union[ uint16, _Unspec] = _Unspec(), timestamp: Union[ uint64, _Unspec] = _Unspec()) -> TimestampedPeerInfo: ... +@final class PoolTarget: puzzle_hash: bytes32 max_height: uint32 @@ -1968,32 +1965,32 @@ class PoolTarget: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> PoolTarget: ... + def __deepcopy__(self, memo: object) -> PoolTarget: ... def __copy__(self) -> PoolTarget: ... - @staticmethod - def from_bytes(bytes) -> PoolTarget: ... - @staticmethod - def from_bytes_unchecked(bytes) -> PoolTarget: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[PoolTarget, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> PoolTarget: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, puzzle_hash: Union[ bytes32, _Unspec] = _Unspec(), max_height: Union[ uint32, _Unspec] = _Unspec()) -> PoolTarget: ... +@final class Program: a0: bytes def get_tree_hash(self) -> bytes32: ... @staticmethod def default() -> Program: ... @staticmethod - def fromhex(hex) -> Program: ... + def fromhex(h: str) -> Program: ... def run_mempool_with_cost(self, max_cost: int, args: object) -> Tuple[int, ChiaProgram]: ... def run_with_cost(self, max_cost: int, args: object) -> Tuple[int, ChiaProgram]: ... def _run(self, max_cost: int, flags: int, args: object) -> Tuple[int, ChiaProgram]: ... @@ -2009,24 +2006,23 @@ class Program: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> Program: ... + def __deepcopy__(self, memo: object) -> Program: ... def __copy__(self) -> Program: ... - @staticmethod - def from_bytes(bytes) -> Program: ... - @staticmethod - def from_bytes_unchecked(bytes) -> Program: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[Program, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> Program: ... - def replace(self, *, a0: Union[ bytes, _Unspec] = _Unspec()) -> Program: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... +@final class ProofOfSpace: challenge: bytes32 pool_public_key: Optional[G1Element] @@ -2045,22 +2041,21 @@ class ProofOfSpace: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> ProofOfSpace: ... + def __deepcopy__(self, memo: object) -> ProofOfSpace: ... def __copy__(self) -> ProofOfSpace: ... - @staticmethod - def from_bytes(bytes) -> ProofOfSpace: ... - @staticmethod - def from_bytes_unchecked(bytes) -> ProofOfSpace: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[ProofOfSpace, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> ProofOfSpace: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, challenge: Union[ bytes32, _Unspec] = _Unspec(), pool_public_key: Union[ Optional[G1Element], _Unspec] = _Unspec(), pool_contract_puzzle_hash: Union[ Optional[bytes32], _Unspec] = _Unspec(), @@ -2068,6 +2063,7 @@ class ProofOfSpace: size: Union[ uint8, _Unspec] = _Unspec(), proof: Union[ bytes, _Unspec] = _Unspec()) -> ProofOfSpace: ... +@final class RewardChainBlockUnfinished: total_iters: uint128 signage_point_index: uint8 @@ -2090,22 +2086,21 @@ class RewardChainBlockUnfinished: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RewardChainBlockUnfinished: ... + def __deepcopy__(self, memo: object) -> RewardChainBlockUnfinished: ... def __copy__(self) -> RewardChainBlockUnfinished: ... - @staticmethod - def from_bytes(bytes) -> RewardChainBlockUnfinished: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RewardChainBlockUnfinished: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RewardChainBlockUnfinished, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RewardChainBlockUnfinished: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, total_iters: Union[ uint128, _Unspec] = _Unspec(), signage_point_index: Union[ uint8, _Unspec] = _Unspec(), pos_ss_cc_challenge_hash: Union[ bytes32, _Unspec] = _Unspec(), @@ -2115,6 +2110,7 @@ class RewardChainBlockUnfinished: reward_chain_sp_vdf: Union[ Optional[VDFInfo], _Unspec] = _Unspec(), reward_chain_sp_signature: Union[ G2Element, _Unspec] = _Unspec()) -> RewardChainBlockUnfinished: ... +@final class RewardChainBlock: weight: uint128 height: uint32 @@ -2150,22 +2146,21 @@ class RewardChainBlock: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RewardChainBlock: ... + def __deepcopy__(self, memo: object) -> RewardChainBlock: ... def __copy__(self) -> RewardChainBlock: ... - @staticmethod - def from_bytes(bytes) -> RewardChainBlock: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RewardChainBlock: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RewardChainBlock, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RewardChainBlock: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, weight: Union[ uint128, _Unspec] = _Unspec(), height: Union[ uint32, _Unspec] = _Unspec(), total_iters: Union[ uint128, _Unspec] = _Unspec(), @@ -2181,6 +2176,7 @@ class RewardChainBlock: infused_challenge_chain_ip_vdf: Union[ Optional[VDFInfo], _Unspec] = _Unspec(), is_transaction_block: Union[ bool, _Unspec] = _Unspec()) -> RewardChainBlock: ... +@final class ChallengeBlockInfo: proof_of_space: ProofOfSpace challenge_chain_sp_vdf: Optional[VDFInfo] @@ -2195,27 +2191,27 @@ class ChallengeBlockInfo: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> ChallengeBlockInfo: ... + def __deepcopy__(self, memo: object) -> ChallengeBlockInfo: ... def __copy__(self) -> ChallengeBlockInfo: ... - @staticmethod - def from_bytes(bytes) -> ChallengeBlockInfo: ... - @staticmethod - def from_bytes_unchecked(bytes) -> ChallengeBlockInfo: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[ChallengeBlockInfo, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> ChallengeBlockInfo: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, proof_of_space: Union[ ProofOfSpace, _Unspec] = _Unspec(), challenge_chain_sp_vdf: Union[ Optional[VDFInfo], _Unspec] = _Unspec(), challenge_chain_sp_signature: Union[ G2Element, _Unspec] = _Unspec(), challenge_chain_ip_vdf: Union[ VDFInfo, _Unspec] = _Unspec()) -> ChallengeBlockInfo: ... +@final class ChallengeChainSubSlot: challenge_chain_end_of_slot_vdf: VDFInfo infused_challenge_chain_sub_slot_hash: Optional[bytes32] @@ -2232,28 +2228,28 @@ class ChallengeChainSubSlot: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> ChallengeChainSubSlot: ... + def __deepcopy__(self, memo: object) -> ChallengeChainSubSlot: ... def __copy__(self) -> ChallengeChainSubSlot: ... - @staticmethod - def from_bytes(bytes) -> ChallengeChainSubSlot: ... - @staticmethod - def from_bytes_unchecked(bytes) -> ChallengeChainSubSlot: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[ChallengeChainSubSlot, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> ChallengeChainSubSlot: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, challenge_chain_end_of_slot_vdf: Union[ VDFInfo, _Unspec] = _Unspec(), infused_challenge_chain_sub_slot_hash: Union[ Optional[bytes32], _Unspec] = _Unspec(), subepoch_summary_hash: Union[ Optional[bytes32], _Unspec] = _Unspec(), new_sub_slot_iters: Union[ Optional[uint64], _Unspec] = _Unspec(), new_difficulty: Union[ Optional[uint64], _Unspec] = _Unspec()) -> ChallengeChainSubSlot: ... +@final class InfusedChallengeChainSubSlot: infused_challenge_chain_end_of_slot_vdf: VDFInfo def __init__( @@ -2262,24 +2258,24 @@ class InfusedChallengeChainSubSlot: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> InfusedChallengeChainSubSlot: ... + def __deepcopy__(self, memo: object) -> InfusedChallengeChainSubSlot: ... def __copy__(self) -> InfusedChallengeChainSubSlot: ... - @staticmethod - def from_bytes(bytes) -> InfusedChallengeChainSubSlot: ... - @staticmethod - def from_bytes_unchecked(bytes) -> InfusedChallengeChainSubSlot: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[InfusedChallengeChainSubSlot, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> InfusedChallengeChainSubSlot: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, infused_challenge_chain_end_of_slot_vdf: Union[ VDFInfo, _Unspec] = _Unspec()) -> InfusedChallengeChainSubSlot: ... +@final class RewardChainSubSlot: end_of_slot_vdf: VDFInfo challenge_chain_sub_slot_hash: bytes32 @@ -2294,27 +2290,27 @@ class RewardChainSubSlot: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RewardChainSubSlot: ... + def __deepcopy__(self, memo: object) -> RewardChainSubSlot: ... def __copy__(self) -> RewardChainSubSlot: ... - @staticmethod - def from_bytes(bytes) -> RewardChainSubSlot: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RewardChainSubSlot: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RewardChainSubSlot, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RewardChainSubSlot: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, end_of_slot_vdf: Union[ VDFInfo, _Unspec] = _Unspec(), challenge_chain_sub_slot_hash: Union[ bytes32, _Unspec] = _Unspec(), infused_challenge_chain_sub_slot_hash: Union[ Optional[bytes32], _Unspec] = _Unspec(), deficit: Union[ uint8, _Unspec] = _Unspec()) -> RewardChainSubSlot: ... +@final class SubSlotProofs: challenge_chain_slot_proof: VDFProof infused_challenge_chain_slot_proof: Optional[VDFProof] @@ -2327,31 +2323,31 @@ class SubSlotProofs: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> SubSlotProofs: ... + def __deepcopy__(self, memo: object) -> SubSlotProofs: ... def __copy__(self) -> SubSlotProofs: ... - @staticmethod - def from_bytes(bytes) -> SubSlotProofs: ... - @staticmethod - def from_bytes_unchecked(bytes) -> SubSlotProofs: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[SubSlotProofs, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> SubSlotProofs: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, challenge_chain_slot_proof: Union[ VDFProof, _Unspec] = _Unspec(), infused_challenge_chain_slot_proof: Union[ Optional[VDFProof], _Unspec] = _Unspec(), reward_chain_slot_proof: Union[ VDFProof, _Unspec] = _Unspec()) -> SubSlotProofs: ... + class SpendBundle: coin_spends: List[CoinSpend] aggregated_signature: G2Element - @staticmethod - def aggregate(sbs: List[SpendBundle]) -> SpendBundle: ... + @classmethod + def aggregate(cls, spend_bundles: List[SpendBundle]) -> Self: ... def name(self) -> bytes32: ... def removals(self) -> List[Coin]: ... def additions(self) -> List[Coin]: ... @@ -2362,25 +2358,25 @@ class SpendBundle: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> SpendBundle: ... + def __deepcopy__(self, memo: object) -> SpendBundle: ... def __copy__(self) -> SpendBundle: ... - @staticmethod - def from_bytes(bytes) -> SpendBundle: ... - @staticmethod - def from_bytes_unchecked(bytes) -> SpendBundle: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[SpendBundle, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> SpendBundle: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, coin_spends: Union[ List[CoinSpend], _Unspec] = _Unspec(), aggregated_signature: Union[ G2Element, _Unspec] = _Unspec()) -> SpendBundle: ... +@final class SubEpochSummary: prev_subepoch_summary_hash: bytes32 reward_chain_hash: bytes32 @@ -2397,28 +2393,28 @@ class SubEpochSummary: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> SubEpochSummary: ... + def __deepcopy__(self, memo: object) -> SubEpochSummary: ... def __copy__(self) -> SubEpochSummary: ... - @staticmethod - def from_bytes(bytes) -> SubEpochSummary: ... - @staticmethod - def from_bytes_unchecked(bytes) -> SubEpochSummary: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[SubEpochSummary, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> SubEpochSummary: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, prev_subepoch_summary_hash: Union[ bytes32, _Unspec] = _Unspec(), reward_chain_hash: Union[ bytes32, _Unspec] = _Unspec(), num_blocks_overflow: Union[ uint8, _Unspec] = _Unspec(), new_difficulty: Union[ Optional[uint64], _Unspec] = _Unspec(), new_sub_slot_iters: Union[ Optional[uint64], _Unspec] = _Unspec()) -> SubEpochSummary: ... +@final class UnfinishedBlock: finished_sub_slots: List[EndOfSubSlotBundle] reward_chain_block: RewardChainBlockUnfinished @@ -2447,22 +2443,21 @@ class UnfinishedBlock: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> UnfinishedBlock: ... + def __deepcopy__(self, memo: object) -> UnfinishedBlock: ... def __copy__(self) -> UnfinishedBlock: ... - @staticmethod - def from_bytes(bytes) -> UnfinishedBlock: ... - @staticmethod - def from_bytes_unchecked(bytes) -> UnfinishedBlock: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[UnfinishedBlock, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> UnfinishedBlock: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, finished_sub_slots: Union[ List[EndOfSubSlotBundle], _Unspec] = _Unspec(), reward_chain_block: Union[ RewardChainBlockUnfinished, _Unspec] = _Unspec(), challenge_chain_sp_proof: Union[ Optional[VDFProof], _Unspec] = _Unspec(), @@ -2473,6 +2468,7 @@ class UnfinishedBlock: transactions_generator: Union[ Optional[Program], _Unspec] = _Unspec(), transactions_generator_ref_list: Union[ List[uint32], _Unspec] = _Unspec()) -> UnfinishedBlock: ... +@final class UnfinishedHeaderBlock: finished_sub_slots: List[EndOfSubSlotBundle] reward_chain_block: RewardChainBlockUnfinished @@ -2496,22 +2492,21 @@ class UnfinishedHeaderBlock: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> UnfinishedHeaderBlock: ... + def __deepcopy__(self, memo: object) -> UnfinishedHeaderBlock: ... def __copy__(self) -> UnfinishedHeaderBlock: ... - @staticmethod - def from_bytes(bytes) -> UnfinishedHeaderBlock: ... - @staticmethod - def from_bytes_unchecked(bytes) -> UnfinishedHeaderBlock: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[UnfinishedHeaderBlock, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> UnfinishedHeaderBlock: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, finished_sub_slots: Union[ List[EndOfSubSlotBundle], _Unspec] = _Unspec(), reward_chain_block: Union[ RewardChainBlockUnfinished, _Unspec] = _Unspec(), challenge_chain_sp_proof: Union[ Optional[VDFProof], _Unspec] = _Unspec(), @@ -2520,6 +2515,7 @@ class UnfinishedHeaderBlock: foliage_transaction_block: Union[ Optional[FoliageTransactionBlock], _Unspec] = _Unspec(), transactions_filter: Union[ bytes, _Unspec] = _Unspec()) -> UnfinishedHeaderBlock: ... +@final class VDFInfo: challenge: bytes32 number_of_iterations: uint64 @@ -2532,26 +2528,26 @@ class VDFInfo: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> VDFInfo: ... + def __deepcopy__(self, memo: object) -> VDFInfo: ... def __copy__(self) -> VDFInfo: ... - @staticmethod - def from_bytes(bytes) -> VDFInfo: ... - @staticmethod - def from_bytes_unchecked(bytes) -> VDFInfo: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[VDFInfo, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> VDFInfo: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, challenge: Union[ bytes32, _Unspec] = _Unspec(), number_of_iterations: Union[ uint64, _Unspec] = _Unspec(), output: Union[ ClassgroupElement, _Unspec] = _Unspec()) -> VDFInfo: ... +@final class VDFProof: witness_type: uint8 witness: bytes @@ -2564,26 +2560,26 @@ class VDFProof: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> VDFProof: ... + def __deepcopy__(self, memo: object) -> VDFProof: ... def __copy__(self) -> VDFProof: ... - @staticmethod - def from_bytes(bytes) -> VDFProof: ... - @staticmethod - def from_bytes_unchecked(bytes) -> VDFProof: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[VDFProof, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> VDFProof: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, witness_type: Union[ uint8, _Unspec] = _Unspec(), witness: Union[ bytes, _Unspec] = _Unspec(), normalized_to_identity: Union[ bool, _Unspec] = _Unspec()) -> VDFProof: ... +@final class RequestPuzzleSolution: coin_name: bytes32 height: uint32 @@ -2594,25 +2590,25 @@ class RequestPuzzleSolution: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestPuzzleSolution: ... + def __deepcopy__(self, memo: object) -> RequestPuzzleSolution: ... def __copy__(self) -> RequestPuzzleSolution: ... - @staticmethod - def from_bytes(bytes) -> RequestPuzzleSolution: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestPuzzleSolution: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestPuzzleSolution, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestPuzzleSolution: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, coin_name: Union[ bytes32, _Unspec] = _Unspec(), height: Union[ uint32, _Unspec] = _Unspec()) -> RequestPuzzleSolution: ... +@final class PuzzleSolutionResponse: coin_name: bytes32 height: uint32 @@ -2627,27 +2623,27 @@ class PuzzleSolutionResponse: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> PuzzleSolutionResponse: ... + def __deepcopy__(self, memo: object) -> PuzzleSolutionResponse: ... def __copy__(self) -> PuzzleSolutionResponse: ... - @staticmethod - def from_bytes(bytes) -> PuzzleSolutionResponse: ... - @staticmethod - def from_bytes_unchecked(bytes) -> PuzzleSolutionResponse: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[PuzzleSolutionResponse, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> PuzzleSolutionResponse: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, coin_name: Union[ bytes32, _Unspec] = _Unspec(), height: Union[ uint32, _Unspec] = _Unspec(), puzzle: Union[ Program, _Unspec] = _Unspec(), solution: Union[ Program, _Unspec] = _Unspec()) -> PuzzleSolutionResponse: ... +@final class RespondPuzzleSolution: response: PuzzleSolutionResponse def __init__( @@ -2656,24 +2652,24 @@ class RespondPuzzleSolution: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondPuzzleSolution: ... + def __deepcopy__(self, memo: object) -> RespondPuzzleSolution: ... def __copy__(self) -> RespondPuzzleSolution: ... - @staticmethod - def from_bytes(bytes) -> RespondPuzzleSolution: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondPuzzleSolution: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondPuzzleSolution, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondPuzzleSolution: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, response: Union[ PuzzleSolutionResponse, _Unspec] = _Unspec()) -> RespondPuzzleSolution: ... +@final class RejectPuzzleSolution: coin_name: bytes32 height: uint32 @@ -2684,25 +2680,25 @@ class RejectPuzzleSolution: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RejectPuzzleSolution: ... + def __deepcopy__(self, memo: object) -> RejectPuzzleSolution: ... def __copy__(self) -> RejectPuzzleSolution: ... - @staticmethod - def from_bytes(bytes) -> RejectPuzzleSolution: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RejectPuzzleSolution: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RejectPuzzleSolution, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RejectPuzzleSolution: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, coin_name: Union[ bytes32, _Unspec] = _Unspec(), height: Union[ uint32, _Unspec] = _Unspec()) -> RejectPuzzleSolution: ... +@final class SendTransaction: transaction: SpendBundle def __init__( @@ -2711,24 +2707,24 @@ class SendTransaction: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> SendTransaction: ... + def __deepcopy__(self, memo: object) -> SendTransaction: ... def __copy__(self) -> SendTransaction: ... - @staticmethod - def from_bytes(bytes) -> SendTransaction: ... - @staticmethod - def from_bytes_unchecked(bytes) -> SendTransaction: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[SendTransaction, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> SendTransaction: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, transaction: Union[ SpendBundle, _Unspec] = _Unspec()) -> SendTransaction: ... +@final class TransactionAck: txid: bytes32 status: uint8 @@ -2741,26 +2737,26 @@ class TransactionAck: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> TransactionAck: ... + def __deepcopy__(self, memo: object) -> TransactionAck: ... def __copy__(self) -> TransactionAck: ... - @staticmethod - def from_bytes(bytes) -> TransactionAck: ... - @staticmethod - def from_bytes_unchecked(bytes) -> TransactionAck: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[TransactionAck, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> TransactionAck: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, txid: Union[ bytes32, _Unspec] = _Unspec(), status: Union[ uint8, _Unspec] = _Unspec(), error: Union[ Optional[str], _Unspec] = _Unspec()) -> TransactionAck: ... +@final class NewPeakWallet: header_hash: bytes32 height: uint32 @@ -2775,27 +2771,27 @@ class NewPeakWallet: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> NewPeakWallet: ... + def __deepcopy__(self, memo: object) -> NewPeakWallet: ... def __copy__(self) -> NewPeakWallet: ... - @staticmethod - def from_bytes(bytes) -> NewPeakWallet: ... - @staticmethod - def from_bytes_unchecked(bytes) -> NewPeakWallet: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[NewPeakWallet, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> NewPeakWallet: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, header_hash: Union[ bytes32, _Unspec] = _Unspec(), height: Union[ uint32, _Unspec] = _Unspec(), weight: Union[ uint128, _Unspec] = _Unspec(), fork_point_with_previous_peak: Union[ uint32, _Unspec] = _Unspec()) -> NewPeakWallet: ... +@final class RequestBlockHeader: height: uint32 def __init__( @@ -2804,24 +2800,24 @@ class RequestBlockHeader: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestBlockHeader: ... + def __deepcopy__(self, memo: object) -> RequestBlockHeader: ... def __copy__(self) -> RequestBlockHeader: ... - @staticmethod - def from_bytes(bytes) -> RequestBlockHeader: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestBlockHeader: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestBlockHeader, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestBlockHeader: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, height: Union[ uint32, _Unspec] = _Unspec()) -> RequestBlockHeader: ... +@final class RespondBlockHeader: header_block: HeaderBlock def __init__( @@ -2830,24 +2826,24 @@ class RespondBlockHeader: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondBlockHeader: ... + def __deepcopy__(self, memo: object) -> RespondBlockHeader: ... def __copy__(self) -> RespondBlockHeader: ... - @staticmethod - def from_bytes(bytes) -> RespondBlockHeader: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondBlockHeader: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondBlockHeader, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondBlockHeader: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, header_block: Union[ HeaderBlock, _Unspec] = _Unspec()) -> RespondBlockHeader: ... +@final class RejectHeaderRequest: height: uint32 def __init__( @@ -2856,24 +2852,24 @@ class RejectHeaderRequest: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RejectHeaderRequest: ... + def __deepcopy__(self, memo: object) -> RejectHeaderRequest: ... def __copy__(self) -> RejectHeaderRequest: ... - @staticmethod - def from_bytes(bytes) -> RejectHeaderRequest: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RejectHeaderRequest: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RejectHeaderRequest, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RejectHeaderRequest: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, height: Union[ uint32, _Unspec] = _Unspec()) -> RejectHeaderRequest: ... +@final class RequestRemovals: height: uint32 header_hash: bytes32 @@ -2886,26 +2882,26 @@ class RequestRemovals: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestRemovals: ... + def __deepcopy__(self, memo: object) -> RequestRemovals: ... def __copy__(self) -> RequestRemovals: ... - @staticmethod - def from_bytes(bytes) -> RequestRemovals: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestRemovals: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestRemovals, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestRemovals: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, height: Union[ uint32, _Unspec] = _Unspec(), header_hash: Union[ bytes32, _Unspec] = _Unspec(), coin_names: Union[ Optional[List[bytes32]], _Unspec] = _Unspec()) -> RequestRemovals: ... +@final class RespondRemovals: height: uint32 header_hash: bytes32 @@ -2920,27 +2916,27 @@ class RespondRemovals: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondRemovals: ... + def __deepcopy__(self, memo: object) -> RespondRemovals: ... def __copy__(self) -> RespondRemovals: ... - @staticmethod - def from_bytes(bytes) -> RespondRemovals: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondRemovals: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondRemovals, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondRemovals: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, height: Union[ uint32, _Unspec] = _Unspec(), header_hash: Union[ bytes32, _Unspec] = _Unspec(), coins: Union[ List[Tuple[bytes32, Optional[Coin]]], _Unspec] = _Unspec(), proofs: Union[ Optional[List[Tuple[bytes32, bytes]]], _Unspec] = _Unspec()) -> RespondRemovals: ... +@final class RejectRemovalsRequest: height: uint32 header_hash: bytes32 @@ -2951,25 +2947,25 @@ class RejectRemovalsRequest: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RejectRemovalsRequest: ... + def __deepcopy__(self, memo: object) -> RejectRemovalsRequest: ... def __copy__(self) -> RejectRemovalsRequest: ... - @staticmethod - def from_bytes(bytes) -> RejectRemovalsRequest: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RejectRemovalsRequest: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RejectRemovalsRequest, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RejectRemovalsRequest: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, height: Union[ uint32, _Unspec] = _Unspec(), header_hash: Union[ bytes32, _Unspec] = _Unspec()) -> RejectRemovalsRequest: ... +@final class RequestAdditions: height: uint32 header_hash: Optional[bytes32] @@ -2982,26 +2978,26 @@ class RequestAdditions: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestAdditions: ... + def __deepcopy__(self, memo: object) -> RequestAdditions: ... def __copy__(self) -> RequestAdditions: ... - @staticmethod - def from_bytes(bytes) -> RequestAdditions: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestAdditions: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestAdditions, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestAdditions: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, height: Union[ uint32, _Unspec] = _Unspec(), header_hash: Union[ Optional[bytes32], _Unspec] = _Unspec(), puzzle_hashes: Union[ Optional[List[bytes32]], _Unspec] = _Unspec()) -> RequestAdditions: ... +@final class RespondAdditions: height: uint32 header_hash: bytes32 @@ -3016,27 +3012,27 @@ class RespondAdditions: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondAdditions: ... + def __deepcopy__(self, memo: object) -> RespondAdditions: ... def __copy__(self) -> RespondAdditions: ... - @staticmethod - def from_bytes(bytes) -> RespondAdditions: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondAdditions: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondAdditions, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondAdditions: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, height: Union[ uint32, _Unspec] = _Unspec(), header_hash: Union[ bytes32, _Unspec] = _Unspec(), coins: Union[ List[Tuple[bytes32, List[Coin]]], _Unspec] = _Unspec(), proofs: Union[ Optional[List[Tuple[bytes32, bytes, Optional[bytes]]]], _Unspec] = _Unspec()) -> RespondAdditions: ... +@final class RejectAdditionsRequest: height: uint32 header_hash: bytes32 @@ -3047,25 +3043,25 @@ class RejectAdditionsRequest: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RejectAdditionsRequest: ... + def __deepcopy__(self, memo: object) -> RejectAdditionsRequest: ... def __copy__(self) -> RejectAdditionsRequest: ... - @staticmethod - def from_bytes(bytes) -> RejectAdditionsRequest: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RejectAdditionsRequest: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RejectAdditionsRequest, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RejectAdditionsRequest: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, height: Union[ uint32, _Unspec] = _Unspec(), header_hash: Union[ bytes32, _Unspec] = _Unspec()) -> RejectAdditionsRequest: ... +@final class RespondBlockHeaders: start_height: uint32 end_height: uint32 @@ -3078,26 +3074,26 @@ class RespondBlockHeaders: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondBlockHeaders: ... + def __deepcopy__(self, memo: object) -> RespondBlockHeaders: ... def __copy__(self) -> RespondBlockHeaders: ... - @staticmethod - def from_bytes(bytes) -> RespondBlockHeaders: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondBlockHeaders: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondBlockHeaders, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondBlockHeaders: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, start_height: Union[ uint32, _Unspec] = _Unspec(), end_height: Union[ uint32, _Unspec] = _Unspec(), header_blocks: Union[ List[HeaderBlock], _Unspec] = _Unspec()) -> RespondBlockHeaders: ... +@final class RejectBlockHeaders: start_height: uint32 end_height: uint32 @@ -3108,25 +3104,25 @@ class RejectBlockHeaders: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RejectBlockHeaders: ... + def __deepcopy__(self, memo: object) -> RejectBlockHeaders: ... def __copy__(self) -> RejectBlockHeaders: ... - @staticmethod - def from_bytes(bytes) -> RejectBlockHeaders: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RejectBlockHeaders: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RejectBlockHeaders, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RejectBlockHeaders: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, start_height: Union[ uint32, _Unspec] = _Unspec(), end_height: Union[ uint32, _Unspec] = _Unspec()) -> RejectBlockHeaders: ... +@final class RequestBlockHeaders: start_height: uint32 end_height: uint32 @@ -3139,26 +3135,26 @@ class RequestBlockHeaders: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestBlockHeaders: ... + def __deepcopy__(self, memo: object) -> RequestBlockHeaders: ... def __copy__(self) -> RequestBlockHeaders: ... - @staticmethod - def from_bytes(bytes) -> RequestBlockHeaders: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestBlockHeaders: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestBlockHeaders, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestBlockHeaders: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, start_height: Union[ uint32, _Unspec] = _Unspec(), end_height: Union[ uint32, _Unspec] = _Unspec(), return_filter: Union[ bool, _Unspec] = _Unspec()) -> RequestBlockHeaders: ... +@final class RequestHeaderBlocks: start_height: uint32 end_height: uint32 @@ -3169,25 +3165,25 @@ class RequestHeaderBlocks: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestHeaderBlocks: ... + def __deepcopy__(self, memo: object) -> RequestHeaderBlocks: ... def __copy__(self) -> RequestHeaderBlocks: ... - @staticmethod - def from_bytes(bytes) -> RequestHeaderBlocks: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestHeaderBlocks: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestHeaderBlocks, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestHeaderBlocks: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, start_height: Union[ uint32, _Unspec] = _Unspec(), end_height: Union[ uint32, _Unspec] = _Unspec()) -> RequestHeaderBlocks: ... +@final class RejectHeaderBlocks: start_height: uint32 end_height: uint32 @@ -3198,25 +3194,25 @@ class RejectHeaderBlocks: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RejectHeaderBlocks: ... + def __deepcopy__(self, memo: object) -> RejectHeaderBlocks: ... def __copy__(self) -> RejectHeaderBlocks: ... - @staticmethod - def from_bytes(bytes) -> RejectHeaderBlocks: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RejectHeaderBlocks: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RejectHeaderBlocks, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RejectHeaderBlocks: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, start_height: Union[ uint32, _Unspec] = _Unspec(), end_height: Union[ uint32, _Unspec] = _Unspec()) -> RejectHeaderBlocks: ... +@final class RespondHeaderBlocks: start_height: uint32 end_height: uint32 @@ -3229,26 +3225,26 @@ class RespondHeaderBlocks: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondHeaderBlocks: ... + def __deepcopy__(self, memo: object) -> RespondHeaderBlocks: ... def __copy__(self) -> RespondHeaderBlocks: ... - @staticmethod - def from_bytes(bytes) -> RespondHeaderBlocks: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondHeaderBlocks: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondHeaderBlocks, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondHeaderBlocks: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, start_height: Union[ uint32, _Unspec] = _Unspec(), end_height: Union[ uint32, _Unspec] = _Unspec(), header_blocks: Union[ List[HeaderBlock], _Unspec] = _Unspec()) -> RespondHeaderBlocks: ... +@final class RegisterForPhUpdates: puzzle_hashes: List[bytes32] min_height: uint32 @@ -3259,25 +3255,25 @@ class RegisterForPhUpdates: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RegisterForPhUpdates: ... + def __deepcopy__(self, memo: object) -> RegisterForPhUpdates: ... def __copy__(self) -> RegisterForPhUpdates: ... - @staticmethod - def from_bytes(bytes) -> RegisterForPhUpdates: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RegisterForPhUpdates: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RegisterForPhUpdates, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RegisterForPhUpdates: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, puzzle_hashes: Union[ List[bytes32], _Unspec] = _Unspec(), min_height: Union[ uint32, _Unspec] = _Unspec()) -> RegisterForPhUpdates: ... +@final class RespondToPhUpdates: puzzle_hashes: List[bytes32] min_height: uint32 @@ -3290,26 +3286,26 @@ class RespondToPhUpdates: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondToPhUpdates: ... + def __deepcopy__(self, memo: object) -> RespondToPhUpdates: ... def __copy__(self) -> RespondToPhUpdates: ... - @staticmethod - def from_bytes(bytes) -> RespondToPhUpdates: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondToPhUpdates: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondToPhUpdates, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondToPhUpdates: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, puzzle_hashes: Union[ List[bytes32], _Unspec] = _Unspec(), min_height: Union[ uint32, _Unspec] = _Unspec(), coin_states: Union[ List[CoinState], _Unspec] = _Unspec()) -> RespondToPhUpdates: ... +@final class RegisterForCoinUpdates: coin_ids: List[bytes32] min_height: uint32 @@ -3320,25 +3316,25 @@ class RegisterForCoinUpdates: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RegisterForCoinUpdates: ... + def __deepcopy__(self, memo: object) -> RegisterForCoinUpdates: ... def __copy__(self) -> RegisterForCoinUpdates: ... - @staticmethod - def from_bytes(bytes) -> RegisterForCoinUpdates: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RegisterForCoinUpdates: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RegisterForCoinUpdates, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RegisterForCoinUpdates: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, coin_ids: Union[ List[bytes32], _Unspec] = _Unspec(), min_height: Union[ uint32, _Unspec] = _Unspec()) -> RegisterForCoinUpdates: ... +@final class RespondToCoinUpdates: coin_ids: List[bytes32] min_height: uint32 @@ -3351,26 +3347,26 @@ class RespondToCoinUpdates: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondToCoinUpdates: ... + def __deepcopy__(self, memo: object) -> RespondToCoinUpdates: ... def __copy__(self) -> RespondToCoinUpdates: ... - @staticmethod - def from_bytes(bytes) -> RespondToCoinUpdates: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondToCoinUpdates: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondToCoinUpdates, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondToCoinUpdates: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, coin_ids: Union[ List[bytes32], _Unspec] = _Unspec(), min_height: Union[ uint32, _Unspec] = _Unspec(), coin_states: Union[ List[CoinState], _Unspec] = _Unspec()) -> RespondToCoinUpdates: ... +@final class CoinStateUpdate: height: uint32 fork_height: uint32 @@ -3385,27 +3381,27 @@ class CoinStateUpdate: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> CoinStateUpdate: ... + def __deepcopy__(self, memo: object) -> CoinStateUpdate: ... def __copy__(self) -> CoinStateUpdate: ... - @staticmethod - def from_bytes(bytes) -> CoinStateUpdate: ... - @staticmethod - def from_bytes_unchecked(bytes) -> CoinStateUpdate: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[CoinStateUpdate, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> CoinStateUpdate: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, height: Union[ uint32, _Unspec] = _Unspec(), fork_height: Union[ uint32, _Unspec] = _Unspec(), peak_hash: Union[ bytes32, _Unspec] = _Unspec(), items: Union[ List[CoinState], _Unspec] = _Unspec()) -> CoinStateUpdate: ... +@final class RequestChildren: coin_name: bytes32 def __init__( @@ -3414,24 +3410,24 @@ class RequestChildren: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestChildren: ... + def __deepcopy__(self, memo: object) -> RequestChildren: ... def __copy__(self) -> RequestChildren: ... - @staticmethod - def from_bytes(bytes) -> RequestChildren: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestChildren: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestChildren, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestChildren: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, coin_name: Union[ bytes32, _Unspec] = _Unspec()) -> RequestChildren: ... +@final class RespondChildren: coin_states: List[CoinState] def __init__( @@ -3440,24 +3436,24 @@ class RespondChildren: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondChildren: ... + def __deepcopy__(self, memo: object) -> RespondChildren: ... def __copy__(self) -> RespondChildren: ... - @staticmethod - def from_bytes(bytes) -> RespondChildren: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondChildren: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondChildren, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondChildren: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, coin_states: Union[ List[CoinState], _Unspec] = _Unspec()) -> RespondChildren: ... +@final class RequestSesInfo: start_height: uint32 end_height: uint32 @@ -3468,25 +3464,25 @@ class RequestSesInfo: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestSesInfo: ... + def __deepcopy__(self, memo: object) -> RequestSesInfo: ... def __copy__(self) -> RequestSesInfo: ... - @staticmethod - def from_bytes(bytes) -> RequestSesInfo: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestSesInfo: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestSesInfo, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestSesInfo: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, start_height: Union[ uint32, _Unspec] = _Unspec(), end_height: Union[ uint32, _Unspec] = _Unspec()) -> RequestSesInfo: ... +@final class RespondSesInfo: reward_chain_hash: List[bytes32] heights: List[List[uint32]] @@ -3497,25 +3493,25 @@ class RespondSesInfo: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondSesInfo: ... + def __deepcopy__(self, memo: object) -> RespondSesInfo: ... def __copy__(self) -> RespondSesInfo: ... - @staticmethod - def from_bytes(bytes) -> RespondSesInfo: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondSesInfo: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondSesInfo, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondSesInfo: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, reward_chain_hash: Union[ List[bytes32], _Unspec] = _Unspec(), heights: Union[ List[List[uint32]], _Unspec] = _Unspec()) -> RespondSesInfo: ... +@final class RequestFeeEstimates: time_targets: List[uint64] def __init__( @@ -3524,24 +3520,24 @@ class RequestFeeEstimates: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestFeeEstimates: ... + def __deepcopy__(self, memo: object) -> RequestFeeEstimates: ... def __copy__(self) -> RequestFeeEstimates: ... - @staticmethod - def from_bytes(bytes) -> RequestFeeEstimates: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestFeeEstimates: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestFeeEstimates, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestFeeEstimates: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, time_targets: Union[ List[uint64], _Unspec] = _Unspec()) -> RequestFeeEstimates: ... +@final class RespondFeeEstimates: estimates: FeeEstimateGroup def __init__( @@ -3550,24 +3546,24 @@ class RespondFeeEstimates: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondFeeEstimates: ... + def __deepcopy__(self, memo: object) -> RespondFeeEstimates: ... def __copy__(self) -> RespondFeeEstimates: ... - @staticmethod - def from_bytes(bytes) -> RespondFeeEstimates: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondFeeEstimates: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondFeeEstimates, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondFeeEstimates: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, estimates: Union[ FeeEstimateGroup, _Unspec] = _Unspec()) -> RespondFeeEstimates: ... +@final class RequestRemovePuzzleSubscriptions: puzzle_hashes: Optional[List[bytes32]] def __init__( @@ -3576,24 +3572,24 @@ class RequestRemovePuzzleSubscriptions: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestRemovePuzzleSubscriptions: ... + def __deepcopy__(self, memo: object) -> RequestRemovePuzzleSubscriptions: ... def __copy__(self) -> RequestRemovePuzzleSubscriptions: ... - @staticmethod - def from_bytes(bytes) -> RequestRemovePuzzleSubscriptions: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestRemovePuzzleSubscriptions: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestRemovePuzzleSubscriptions, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestRemovePuzzleSubscriptions: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, puzzle_hashes: Union[ Optional[List[bytes32]], _Unspec] = _Unspec()) -> RequestRemovePuzzleSubscriptions: ... +@final class RespondRemovePuzzleSubscriptions: puzzle_hashes: List[bytes32] def __init__( @@ -3602,24 +3598,24 @@ class RespondRemovePuzzleSubscriptions: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondRemovePuzzleSubscriptions: ... + def __deepcopy__(self, memo: object) -> RespondRemovePuzzleSubscriptions: ... def __copy__(self) -> RespondRemovePuzzleSubscriptions: ... - @staticmethod - def from_bytes(bytes) -> RespondRemovePuzzleSubscriptions: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondRemovePuzzleSubscriptions: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondRemovePuzzleSubscriptions, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondRemovePuzzleSubscriptions: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, puzzle_hashes: Union[ List[bytes32], _Unspec] = _Unspec()) -> RespondRemovePuzzleSubscriptions: ... +@final class RequestRemoveCoinSubscriptions: coin_ids: Optional[List[bytes32]] def __init__( @@ -3628,24 +3624,24 @@ class RequestRemoveCoinSubscriptions: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestRemoveCoinSubscriptions: ... + def __deepcopy__(self, memo: object) -> RequestRemoveCoinSubscriptions: ... def __copy__(self) -> RequestRemoveCoinSubscriptions: ... - @staticmethod - def from_bytes(bytes) -> RequestRemoveCoinSubscriptions: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestRemoveCoinSubscriptions: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestRemoveCoinSubscriptions, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestRemoveCoinSubscriptions: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, coin_ids: Union[ Optional[List[bytes32]], _Unspec] = _Unspec()) -> RequestRemoveCoinSubscriptions: ... +@final class RespondRemoveCoinSubscriptions: coin_ids: List[bytes32] def __init__( @@ -3654,24 +3650,24 @@ class RespondRemoveCoinSubscriptions: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondRemoveCoinSubscriptions: ... + def __deepcopy__(self, memo: object) -> RespondRemoveCoinSubscriptions: ... def __copy__(self) -> RespondRemoveCoinSubscriptions: ... - @staticmethod - def from_bytes(bytes) -> RespondRemoveCoinSubscriptions: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondRemoveCoinSubscriptions: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondRemoveCoinSubscriptions, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondRemoveCoinSubscriptions: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, coin_ids: Union[ List[bytes32], _Unspec] = _Unspec()) -> RespondRemoveCoinSubscriptions: ... +@final class CoinStateFilters: include_spent: bool include_unspent: bool @@ -3686,27 +3682,27 @@ class CoinStateFilters: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> CoinStateFilters: ... + def __deepcopy__(self, memo: object) -> CoinStateFilters: ... def __copy__(self) -> CoinStateFilters: ... - @staticmethod - def from_bytes(bytes) -> CoinStateFilters: ... - @staticmethod - def from_bytes_unchecked(bytes) -> CoinStateFilters: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[CoinStateFilters, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> CoinStateFilters: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, include_spent: Union[ bool, _Unspec] = _Unspec(), include_unspent: Union[ bool, _Unspec] = _Unspec(), include_hinted: Union[ bool, _Unspec] = _Unspec(), min_amount: Union[ uint64, _Unspec] = _Unspec()) -> CoinStateFilters: ... +@final class RequestPuzzleState: puzzle_hashes: List[bytes32] previous_height: Optional[uint32] @@ -3723,28 +3719,28 @@ class RequestPuzzleState: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestPuzzleState: ... + def __deepcopy__(self, memo: object) -> RequestPuzzleState: ... def __copy__(self) -> RequestPuzzleState: ... - @staticmethod - def from_bytes(bytes) -> RequestPuzzleState: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestPuzzleState: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestPuzzleState, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestPuzzleState: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, puzzle_hashes: Union[ List[bytes32], _Unspec] = _Unspec(), previous_height: Union[ Optional[uint32], _Unspec] = _Unspec(), header_hash: Union[ bytes32, _Unspec] = _Unspec(), filters: Union[ CoinStateFilters, _Unspec] = _Unspec(), subscribe_when_finished: Union[ bool, _Unspec] = _Unspec()) -> RequestPuzzleState: ... +@final class RespondPuzzleState: puzzle_hashes: List[bytes32] height: uint32 @@ -3761,28 +3757,28 @@ class RespondPuzzleState: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondPuzzleState: ... + def __deepcopy__(self, memo: object) -> RespondPuzzleState: ... def __copy__(self) -> RespondPuzzleState: ... - @staticmethod - def from_bytes(bytes) -> RespondPuzzleState: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondPuzzleState: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondPuzzleState, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondPuzzleState: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, puzzle_hashes: Union[ List[bytes32], _Unspec] = _Unspec(), height: Union[ uint32, _Unspec] = _Unspec(), header_hash: Union[ bytes32, _Unspec] = _Unspec(), is_finished: Union[ bool, _Unspec] = _Unspec(), coin_states: Union[ List[CoinState], _Unspec] = _Unspec()) -> RespondPuzzleState: ... +@final class RejectPuzzleState: reason: int def __init__( @@ -3791,24 +3787,24 @@ class RejectPuzzleState: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RejectPuzzleState: ... + def __deepcopy__(self, memo: object) -> RejectPuzzleState: ... def __copy__(self) -> RejectPuzzleState: ... - @staticmethod - def from_bytes(bytes) -> RejectPuzzleState: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RejectPuzzleState: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RejectPuzzleState, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RejectPuzzleState: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, reason: Union[ int, _Unspec] = _Unspec()) -> RejectPuzzleState: ... +@final class RequestCoinState: coin_ids: List[bytes32] previous_height: Optional[uint32] @@ -3823,27 +3819,27 @@ class RequestCoinState: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RequestCoinState: ... + def __deepcopy__(self, memo: object) -> RequestCoinState: ... def __copy__(self) -> RequestCoinState: ... - @staticmethod - def from_bytes(bytes) -> RequestCoinState: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RequestCoinState: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RequestCoinState, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RequestCoinState: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, coin_ids: Union[ List[bytes32], _Unspec] = _Unspec(), previous_height: Union[ Optional[uint32], _Unspec] = _Unspec(), header_hash: Union[ bytes32, _Unspec] = _Unspec(), subscribe: Union[ bool, _Unspec] = _Unspec()) -> RequestCoinState: ... +@final class RespondCoinState: coin_ids: List[bytes32] coin_states: List[CoinState] @@ -3854,25 +3850,25 @@ class RespondCoinState: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RespondCoinState: ... + def __deepcopy__(self, memo: object) -> RespondCoinState: ... def __copy__(self) -> RespondCoinState: ... - @staticmethod - def from_bytes(bytes) -> RespondCoinState: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RespondCoinState: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RespondCoinState, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RespondCoinState: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, coin_ids: Union[ List[bytes32], _Unspec] = _Unspec(), coin_states: Union[ List[CoinState], _Unspec] = _Unspec()) -> RespondCoinState: ... +@final class RejectCoinState: reason: int def __init__( @@ -3881,24 +3877,24 @@ class RejectCoinState: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RejectCoinState: ... + def __deepcopy__(self, memo: object) -> RejectCoinState: ... def __copy__(self) -> RejectCoinState: ... - @staticmethod - def from_bytes(bytes) -> RejectCoinState: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RejectCoinState: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RejectCoinState, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RejectCoinState: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, reason: Union[ int, _Unspec] = _Unspec()) -> RejectCoinState: ... +@final class SubEpochData: reward_chain_hash: bytes32 num_blocks_overflow: uint8 @@ -3913,27 +3909,27 @@ class SubEpochData: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> SubEpochData: ... + def __deepcopy__(self, memo: object) -> SubEpochData: ... def __copy__(self) -> SubEpochData: ... - @staticmethod - def from_bytes(bytes) -> SubEpochData: ... - @staticmethod - def from_bytes_unchecked(bytes) -> SubEpochData: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[SubEpochData, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> SubEpochData: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, reward_chain_hash: Union[ bytes32, _Unspec] = _Unspec(), num_blocks_overflow: Union[ uint8, _Unspec] = _Unspec(), new_sub_slot_iters: Union[ Optional[uint64], _Unspec] = _Unspec(), new_difficulty: Union[ Optional[uint64], _Unspec] = _Unspec()) -> SubEpochData: ... +@final class SubSlotData: proof_of_space: Optional[ProofOfSpace] cc_signage_point: Optional[VDFProof] @@ -3968,22 +3964,21 @@ class SubSlotData: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> SubSlotData: ... + def __deepcopy__(self, memo: object) -> SubSlotData: ... def __copy__(self) -> SubSlotData: ... - @staticmethod - def from_bytes(bytes) -> SubSlotData: ... - @staticmethod - def from_bytes_unchecked(bytes) -> SubSlotData: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[SubSlotData, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> SubSlotData: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, proof_of_space: Union[ Optional[ProofOfSpace], _Unspec] = _Unspec(), cc_signage_point: Union[ Optional[VDFProof], _Unspec] = _Unspec(), cc_infusion_point: Union[ Optional[VDFProof], _Unspec] = _Unspec(), @@ -3998,6 +3993,7 @@ class SubSlotData: icc_ip_vdf_info: Union[ Optional[VDFInfo], _Unspec] = _Unspec(), total_iters: Union[ Optional[uint128], _Unspec] = _Unspec()) -> SubSlotData: ... +@final class SubEpochChallengeSegment: sub_epoch_n: uint32 sub_slots: List[SubSlotData] @@ -4010,26 +4006,26 @@ class SubEpochChallengeSegment: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> SubEpochChallengeSegment: ... + def __deepcopy__(self, memo: object) -> SubEpochChallengeSegment: ... def __copy__(self) -> SubEpochChallengeSegment: ... - @staticmethod - def from_bytes(bytes) -> SubEpochChallengeSegment: ... - @staticmethod - def from_bytes_unchecked(bytes) -> SubEpochChallengeSegment: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[SubEpochChallengeSegment, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> SubEpochChallengeSegment: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, sub_epoch_n: Union[ uint32, _Unspec] = _Unspec(), sub_slots: Union[ List[SubSlotData], _Unspec] = _Unspec(), rc_slot_end_info: Union[ Optional[VDFInfo], _Unspec] = _Unspec()) -> SubEpochChallengeSegment: ... +@final class SubEpochSegments: challenge_segments: List[SubEpochChallengeSegment] def __init__( @@ -4038,24 +4034,24 @@ class SubEpochSegments: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> SubEpochSegments: ... + def __deepcopy__(self, memo: object) -> SubEpochSegments: ... def __copy__(self) -> SubEpochSegments: ... - @staticmethod - def from_bytes(bytes) -> SubEpochSegments: ... - @staticmethod - def from_bytes_unchecked(bytes) -> SubEpochSegments: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[SubEpochSegments, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> SubEpochSegments: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, challenge_segments: Union[ List[SubEpochChallengeSegment], _Unspec] = _Unspec()) -> SubEpochSegments: ... +@final class RecentChainData: recent_chain_data: List[HeaderBlock] def __init__( @@ -4064,24 +4060,24 @@ class RecentChainData: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> RecentChainData: ... + def __deepcopy__(self, memo: object) -> RecentChainData: ... def __copy__(self) -> RecentChainData: ... - @staticmethod - def from_bytes(bytes) -> RecentChainData: ... - @staticmethod - def from_bytes_unchecked(bytes) -> RecentChainData: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[RecentChainData, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> RecentChainData: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, recent_chain_data: Union[ List[HeaderBlock], _Unspec] = _Unspec()) -> RecentChainData: ... +@final class ProofBlockHeader: finished_sub_slots: List[EndOfSubSlotBundle] reward_chain_block: RewardChainBlock @@ -4092,25 +4088,25 @@ class ProofBlockHeader: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> ProofBlockHeader: ... + def __deepcopy__(self, memo: object) -> ProofBlockHeader: ... def __copy__(self) -> ProofBlockHeader: ... - @staticmethod - def from_bytes(bytes) -> ProofBlockHeader: ... - @staticmethod - def from_bytes_unchecked(bytes) -> ProofBlockHeader: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[ProofBlockHeader, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> ProofBlockHeader: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, finished_sub_slots: Union[ List[EndOfSubSlotBundle], _Unspec] = _Unspec(), reward_chain_block: Union[ RewardChainBlock, _Unspec] = _Unspec()) -> ProofBlockHeader: ... +@final class WeightProof: sub_epochs: List[SubEpochData] sub_epoch_segments: List[SubEpochChallengeSegment] @@ -4123,26 +4119,26 @@ class WeightProof: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> WeightProof: ... + def __deepcopy__(self, memo: object) -> WeightProof: ... def __copy__(self) -> WeightProof: ... - @staticmethod - def from_bytes(bytes) -> WeightProof: ... - @staticmethod - def from_bytes_unchecked(bytes) -> WeightProof: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[WeightProof, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> WeightProof: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, sub_epochs: Union[ List[SubEpochData], _Unspec] = _Unspec(), sub_epoch_segments: Union[ List[SubEpochChallengeSegment], _Unspec] = _Unspec(), recent_chain_data: Union[ List[HeaderBlock], _Unspec] = _Unspec()) -> WeightProof: ... +@final class ConsensusConstants: SLOT_BLOCKS_TARGET: uint32 MIN_BLOCKS_PER_CHALLENGE_BLOCK: uint8 @@ -4241,22 +4237,21 @@ class ConsensusConstants: ) -> None: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... - def __richcmp__(self) -> Any: ... - def __deepcopy__(self) -> ConsensusConstants: ... + def __deepcopy__(self, memo: object) -> ConsensusConstants: ... def __copy__(self) -> ConsensusConstants: ... - @staticmethod - def from_bytes(bytes) -> ConsensusConstants: ... - @staticmethod - def from_bytes_unchecked(bytes) -> ConsensusConstants: ... - @staticmethod - def parse_rust(ReadableBuffer, bool = False) -> Tuple[ConsensusConstants, int]: ... + @classmethod + def from_bytes(cls, blob: bytes) -> Self: ... + @classmethod + def from_bytes_unchecked(cls, blob: bytes) -> Self: ... + @classmethod + def parse_rust(cls, blob: ReadableBuffer, trusted: bool = False) -> Tuple[Self, int]: ... def to_bytes(self) -> bytes: ... def __bytes__(self) -> bytes: ... def stream_to_bytes(self) -> bytes: ... def get_hash(self) -> bytes32: ... def to_json_dict(self) -> Any: ... - @staticmethod - def from_json_dict(json_dict: Any) -> ConsensusConstants: ... + @classmethod + def from_json_dict(cls, json_dict: Any) -> Self: ... def replace(self, *, SLOT_BLOCKS_TARGET: Union[ uint32, _Unspec] = _Unspec(), MIN_BLOCKS_PER_CHALLENGE_BLOCK: Union[ uint8, _Unspec] = _Unspec(), MAX_SUB_SLOT_BLOCKS: Union[ uint32, _Unspec] = _Unspec(), diff --git a/wheel/src/api.rs b/wheel/src/api.rs index 2dd9fe980..f7d5f4d9c 100644 --- a/wheel/src/api.rs +++ b/wheel/src/api.rs @@ -3,8 +3,7 @@ use chia_consensus::allocator::make_allocator; use chia_consensus::consensus_constants::ConsensusConstants; use chia_consensus::gen::conditions::MempoolVisitor; use chia_consensus::gen::flags::{ - ALLOW_BACKREFS, ANALYZE_SPENDS, DISALLOW_INFINITY_G1, MEMPOOL_MODE, NO_UNKNOWN_CONDS, - STRICT_ARGS_COUNT, + ALLOW_BACKREFS, MEMPOOL_MODE, NO_UNKNOWN_CONDS, STRICT_ARGS_COUNT, }; use chia_consensus::gen::owned_conditions::{OwnedSpendBundleConditions, OwnedSpendConditions}; use chia_consensus::gen::run_block_generator::setup_generator_args; @@ -19,32 +18,33 @@ use chia_consensus::spendbundle_validation::{ }; use chia_protocol::{ BlockRecord, Bytes32, ChallengeBlockInfo, ChallengeChainSubSlot, ClassgroupElement, Coin, - CoinSpend, CoinState, CoinStateFilters, CoinStateUpdate, EndOfSubSlotBundle, Foliage, - FoliageBlockData, FoliageTransactionBlock, FullBlock, HeaderBlock, - InfusedChallengeChainSubSlot, NewCompactVDF, NewPeak, NewPeakWallet, - NewSignagePointOrEndOfSubSlot, NewTransaction, NewUnfinishedBlock, NewUnfinishedBlock2, - PoolTarget, Program, ProofBlockHeader, ProofOfSpace, PuzzleSolutionResponse, RecentChainData, - RegisterForCoinUpdates, RegisterForPhUpdates, RejectAdditionsRequest, RejectBlock, - RejectBlockHeaders, RejectBlocks, RejectCoinState, RejectHeaderBlocks, RejectHeaderRequest, - RejectPuzzleSolution, RejectPuzzleState, RejectRemovalsRequest, RequestAdditions, RequestBlock, - RequestBlockHeader, RequestBlockHeaders, RequestBlocks, RequestChildren, RequestCoinState, - RequestCompactVDF, RequestFeeEstimates, RequestHeaderBlocks, RequestMempoolTransactions, - RequestPeers, RequestProofOfWeight, RequestPuzzleSolution, RequestPuzzleState, RequestRemovals, - RequestRemoveCoinSubscriptions, RequestRemovePuzzleSubscriptions, RequestSesInfo, - RequestSignagePointOrEndOfSubSlot, RequestTransaction, RequestUnfinishedBlock, - RequestUnfinishedBlock2, RespondAdditions, RespondBlock, RespondBlockHeader, - RespondBlockHeaders, RespondBlocks, RespondChildren, RespondCoinState, RespondCompactVDF, - RespondEndOfSubSlot, RespondFeeEstimates, RespondHeaderBlocks, RespondPeers, - RespondProofOfWeight, RespondPuzzleSolution, RespondPuzzleState, RespondRemovals, - RespondRemoveCoinSubscriptions, RespondRemovePuzzleSubscriptions, RespondSesInfo, - RespondSignagePoint, RespondToCoinUpdates, RespondToPhUpdates, RespondTransaction, - RespondUnfinishedBlock, RewardChainBlock, RewardChainBlockUnfinished, RewardChainSubSlot, - SendTransaction, SpendBundle, SubEpochChallengeSegment, SubEpochData, SubEpochSegments, - SubEpochSummary, SubSlotData, SubSlotProofs, TimestampedPeerInfo, TransactionAck, - TransactionsInfo, UnfinishedBlock, UnfinishedHeaderBlock, VDFInfo, VDFProof, WeightProof, + CoinSpend, CoinState, CoinStateFilters, CoinStateUpdate, EndOfSubSlotBundle, FeeEstimate, + FeeEstimateGroup, FeeRate, Foliage, FoliageBlockData, FoliageTransactionBlock, FullBlock, + Handshake, HeaderBlock, InfusedChallengeChainSubSlot, LazyNode, Message, NewCompactVDF, + NewPeak, NewPeakWallet, NewSignagePointOrEndOfSubSlot, NewTransaction, NewUnfinishedBlock, + NewUnfinishedBlock2, PoolTarget, Program, ProofBlockHeader, ProofOfSpace, + PuzzleSolutionResponse, RecentChainData, RegisterForCoinUpdates, RegisterForPhUpdates, + RejectAdditionsRequest, RejectBlock, RejectBlockHeaders, RejectBlocks, RejectCoinState, + RejectHeaderBlocks, RejectHeaderRequest, RejectPuzzleSolution, RejectPuzzleState, + RejectRemovalsRequest, RequestAdditions, RequestBlock, RequestBlockHeader, RequestBlockHeaders, + RequestBlocks, RequestChildren, RequestCoinState, RequestCompactVDF, RequestFeeEstimates, + RequestHeaderBlocks, RequestMempoolTransactions, RequestPeers, RequestProofOfWeight, + RequestPuzzleSolution, RequestPuzzleState, RequestRemovals, RequestRemoveCoinSubscriptions, + RequestRemovePuzzleSubscriptions, RequestSesInfo, RequestSignagePointOrEndOfSubSlot, + RequestTransaction, RequestUnfinishedBlock, RequestUnfinishedBlock2, RespondAdditions, + RespondBlock, RespondBlockHeader, RespondBlockHeaders, RespondBlocks, RespondChildren, + RespondCoinState, RespondCompactVDF, RespondEndOfSubSlot, RespondFeeEstimates, + RespondHeaderBlocks, RespondPeers, RespondProofOfWeight, RespondPuzzleSolution, + RespondPuzzleState, RespondRemovals, RespondRemoveCoinSubscriptions, + RespondRemovePuzzleSubscriptions, RespondSesInfo, RespondSignagePoint, RespondToCoinUpdates, + RespondToPhUpdates, RespondTransaction, RespondUnfinishedBlock, RewardChainBlock, + RewardChainBlockUnfinished, RewardChainSubSlot, SendTransaction, SpendBundle, + SubEpochChallengeSegment, SubEpochData, SubEpochSegments, SubEpochSummary, SubSlotData, + SubSlotProofs, TimestampedPeerInfo, TransactionAck, TransactionsInfo, UnfinishedBlock, + UnfinishedHeaderBlock, VDFInfo, VDFProof, WeightProof, }; use clvm_utils::tree_hash_from_bytes; -use clvmr::{ENABLE_BLS_OPS_OUTSIDE_GUARD, ENABLE_FIXED_DIV, LIMIT_HEAP, NO_UNKNOWN_OPS}; +use clvmr::{LIMIT_HEAP, NO_UNKNOWN_OPS}; use pyo3::buffer::PyBuffer; use pyo3::exceptions::{PyRuntimeError, PyTypeError, PyValueError}; use pyo3::prelude::*; @@ -424,16 +424,19 @@ fn fast_forward_singleton<'p>( #[pyo3(name = "validate_clvm_and_signature")] #[allow(clippy::type_complexity)] pub fn py_validate_clvm_and_signature( + py: Python<'_>, new_spend: &SpendBundle, max_cost: u64, constants: &ConsensusConstants, peak_height: u32, ) -> PyResult<(OwnedSpendBundleConditions, Vec<([u8; 32], GTElement)>, f32)> { - let (owned_conditions, additions, duration) = - validate_clvm_and_signature(new_spend, max_cost, constants, peak_height).map_err(|e| { + let (owned_conditions, additions, duration) = py + .allow_threads(|| validate_clvm_and_signature(new_spend, max_cost, constants, peak_height)) + .map_err(|e| { + // cast validation error to int let error_code: u32 = e.into(); PyErr::new::(error_code) - })?; // cast validation error to int + })?; Ok((owned_conditions, additions, duration.as_secs_f32())) } @@ -503,11 +506,8 @@ pub fn chia_rs(_py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> { // clvm functions m.add("NO_UNKNOWN_CONDS", NO_UNKNOWN_CONDS)?; m.add("STRICT_ARGS_COUNT", STRICT_ARGS_COUNT)?; - m.add("ENABLE_FIXED_DIV", ENABLE_FIXED_DIV)?; m.add("MEMPOOL_MODE", MEMPOOL_MODE)?; m.add("ALLOW_BACKREFS", ALLOW_BACKREFS)?; - m.add("ANALYZE_SPENDS", ANALYZE_SPENDS)?; - m.add("DISALLOW_INFINITY_G1", DISALLOW_INFINITY_G1)?; // Chia classes m.add_class::()?; @@ -621,13 +621,18 @@ pub fn chia_rs(_py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> { m.add_class::()?; m.add_class::()?; m.add_class::()?; + m.add_class::()?; + m.add_class::()?; + m.add_class::()?; + m.add_class::()?; + m.add_class::()?; + m.add_class::()?; // facilities from clvm_rs m.add_function(wrap_pyfunction!(run_chia_program, m)?)?; m.add("NO_UNKNOWN_OPS", NO_UNKNOWN_OPS)?; m.add("LIMIT_HEAP", LIMIT_HEAP)?; - m.add("ENABLE_BLS_OPS_OUTSIDE_GUARD", ENABLE_BLS_OPS_OUTSIDE_GUARD)?; m.add_function(wrap_pyfunction!(serialized_length, m)?)?; m.add_function(wrap_pyfunction!(compute_merkle_set_root, m)?)?; diff --git a/wheel/src/run_generator.rs b/wheel/src/run_generator.rs index bc364728b..8c628db75 100644 --- a/wheel/src/run_generator.rs +++ b/wheel/src/run_generator.rs @@ -1,7 +1,5 @@ use chia_consensus::allocator::make_allocator; use chia_consensus::consensus_constants::ConsensusConstants; -use chia_consensus::gen::conditions::{EmptyVisitor, MempoolVisitor}; -use chia_consensus::gen::flags::ANALYZE_SPENDS; use chia_consensus::gen::owned_conditions::OwnedSpendBundleConditions; use chia_consensus::gen::run_block_generator::run_block_generator as native_run_block_generator; use chia_consensus::gen::run_block_generator::run_block_generator2 as native_run_block_generator2; @@ -20,7 +18,7 @@ pub fn py_to_slice<'a>(buf: PyBuffer) -> &'a [u8] { #[pyfunction] pub fn run_block_generator<'a>( - _py: Python<'a>, + py: Python<'a>, program: PyBuffer, block_refs: &Bound<'_, PyList>, max_cost: Cost, @@ -29,37 +27,38 @@ pub fn run_block_generator<'a>( ) -> (Option, Option) { let mut allocator = make_allocator(flags); - let refs = block_refs.into_iter().map(|b| { - let buf = b - .extract::>() - .expect("block_refs should be a list of buffers"); - py_to_slice::<'a>(buf) - }); + let refs = block_refs + .into_iter() + .map(|b| { + let buf = b + .extract::>() + .expect("block_refs should be a list of buffers"); + py_to_slice::<'a>(buf) + }) + .collect::>(); let program = py_to_slice::<'a>(program); - let run_block = if (flags & ANALYZE_SPENDS) == 0 { - native_run_block_generator::<_, EmptyVisitor, _> - } else { - native_run_block_generator::<_, MempoolVisitor, _> - }; - match run_block(&mut allocator, program, refs, max_cost, flags, constants) { - Ok(spend_bundle_conds) => ( - None, - Some(OwnedSpendBundleConditions::from( - &allocator, - spend_bundle_conds, - )), - ), - Err(ValidationErr(_, error_code)) => { - // a validation error occurred - (Some(error_code.into()), None) + py.allow_threads(|| { + match native_run_block_generator(&mut allocator, program, refs, max_cost, flags, constants) + { + Ok(spend_bundle_conds) => ( + None, + Some(OwnedSpendBundleConditions::from( + &allocator, + spend_bundle_conds, + )), + ), + Err(ValidationErr(_, error_code)) => { + // a validation error occurred + (Some(error_code.into()), None) + } } - } + }) } #[pyfunction] pub fn run_block_generator2<'a>( - _py: Python<'a>, + py: Python<'a>, program: PyBuffer, block_refs: &Bound<'_, PyList>, max_cost: Cost, @@ -68,31 +67,32 @@ pub fn run_block_generator2<'a>( ) -> (Option, Option) { let mut allocator = make_allocator(flags); - let refs = block_refs.into_iter().map(|b| { - let buf = b - .extract::>() - .expect("block_refs must be list of buffers"); - py_to_slice::<'a>(buf) - }); + let refs = block_refs + .into_iter() + .map(|b| { + let buf = b + .extract::>() + .expect("block_refs must be list of buffers"); + py_to_slice::<'a>(buf) + }) + .collect::>(); let program = py_to_slice::<'a>(program); - let run_block = if (flags & ANALYZE_SPENDS) == 0 { - native_run_block_generator2::<_, EmptyVisitor, _> - } else { - native_run_block_generator2::<_, MempoolVisitor, _> - }; - match run_block(&mut allocator, program, refs, max_cost, flags, constants) { - Ok(spend_bundle_conds) => ( - None, - Some(OwnedSpendBundleConditions::from( - &allocator, - spend_bundle_conds, - )), - ), - Err(ValidationErr(_, error_code)) => { - // a validation error occurred - (Some(error_code.into()), None) + py.allow_threads(|| { + match native_run_block_generator2(&mut allocator, program, refs, max_cost, flags, constants) + { + Ok(spend_bundle_conds) => ( + None, + Some(OwnedSpendBundleConditions::from( + &allocator, + spend_bundle_conds, + )), + ), + Err(ValidationErr(_, error_code)) => { + // a validation error occurred + (Some(error_code.into()), None) + } } - } + }) } diff --git a/wheel/stubtest.allowlist b/wheel/stubtest.allowlist new file mode 100644 index 000000000..36d5afaf3 --- /dev/null +++ b/wheel/stubtest.allowlist @@ -0,0 +1,71 @@ +# this is offered to help with hinting only and is not intended to be +# runtime accessible. is there a better option for handling this? +chia_rs.ReadableBuffer +chia_rs.chia_rs.ReadableBuffer + +# TODO: perhaps these should be private as _* +chia_rs.BlockRecord.ip_iters_impl +chia_rs.BlockRecord.ip_sub_slot_total_iters_impl +chia_rs.BlockRecord.sp_iters_impl +chia_rs.BlockRecord.sp_sub_slot_total_iters_impl +chia_rs.BlockRecord.sp_total_iters_impl +chia_rs.chia_rs.BlockRecord.ip_iters_impl +chia_rs.chia_rs.BlockRecord.ip_sub_slot_total_iters_impl +chia_rs.chia_rs.BlockRecord.sp_iters_impl +chia_rs.chia_rs.BlockRecord.sp_sub_slot_total_iters_impl +chia_rs.chia_rs.BlockRecord.sp_total_iters_impl + +# TODO: perhaps the inner should be private as _chia_rs +# chia_rs.chia_rs + +# TODO: G1Element->PublicKey expects *args +chia_rs.G1Element.__init__ +chia_rs.chia_rs.G1Element.__init__ + +# TODO: G2Element->Signature expects *args +chia_rs.G2Element.__init__ +chia_rs.chia_rs.G2Element.__init__ + +# TODO: expects *args +chia_rs.GTElement.__init__ +chia_rs.chia_rs.GTElement.__init__ + +# TODO: PrivateKey->SecretKey expects *args +chia_rs.PrivateKey.__init__ +chia_rs.chia_rs.PrivateKey.__init__ + +# TODO: expects *args +chia_rs.RequestPeers.__init__ +chia_rs.chia_rs.RequestPeers.__init__ + +# TODO: ask stubtest/mypy about these as they seem unlikely to be our doing +chia_rs.sized_byte_class.Iterable +chia_rs.sized_byte_class.BinaryIO.write +chia_rs.struct_stream.BinaryIO.write + +# these raise unimplemented +chia_rs.G1Element.from_parent +chia_rs.G2Element.from_parent +chia_rs.GTElement.from_parent +chia_rs.PrivateKey.from_parent +chia_rs.Program.from_parent +chia_rs.Spend.from_parent +chia_rs.SpendBundleConditions.from_parent +chia_rs.SpendConditions.from_parent +chia_rs.chia_rs.G1Element.from_parent +chia_rs.chia_rs.G2Element.from_parent +chia_rs.chia_rs.GTElement.from_parent +chia_rs.chia_rs.PrivateKey.from_parent +chia_rs.chia_rs.Program.from_parent +chia_rs.chia_rs.SpendBundleConditions.from_parent +chia_rs.chia_rs.SpendConditions.from_parent +chia_rs.spend.Spend.from_parent +chia_rs.spend.SpendConditions.from_parent + +# these are implemented but not intended to be called from python +chia_rs.Coin.from_parent +chia_rs.CoinSpend.from_parent +chia_rs.SpendBundle.from_parent +chia_rs.chia_rs.Coin.from_parent +chia_rs.chia_rs.CoinSpend.from_parent +chia_rs.chia_rs.SpendBundle.from_parent diff --git a/wheel/stubtest.allowlist.3-11-plus b/wheel/stubtest.allowlist.3-11-plus new file mode 100644 index 000000000..746a42d90 --- /dev/null +++ b/wheel/stubtest.allowlist.3-11-plus @@ -0,0 +1,10 @@ +# TODO: ask stubtest/mypy about these as they seem unlikely to be our doing +chia_rs.sized_byte_class.TypeVar.__bound__ +chia_rs.sized_byte_class.TypeVar.__constraints__ +chia_rs.sized_byte_class.TypeVar.__contravariant__ +chia_rs.sized_byte_class.TypeVar.__covariant__ + +chia_rs.struct_stream.TypeVar.__bound__ +chia_rs.struct_stream.TypeVar.__constraints__ +chia_rs.struct_stream.TypeVar.__contravariant__ +chia_rs.struct_stream.TypeVar.__covariant__