diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index ca749f774..9a25098e0 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -305,11 +305,11 @@ jobs: override: true - name: workspace run: | - cargo clippy --workspace --all-features + cargo clippy --workspace --all-features -- -Dwarnings - name: wheel run: | cd wheel - cargo clippy + cargo clippy --all-features -- -Dwarnings fuzz_targets: runs-on: ubuntu-latest diff --git a/chia-bls/src/public_key.rs b/chia-bls/src/public_key.rs index 696ee6f1e..a13b2c4e5 100644 --- a/chia-bls/src/public_key.rs +++ b/chia-bls/src/public_key.rs @@ -219,7 +219,11 @@ impl ToJsonDict for PublicKey { pub fn parse_hex_string(o: &PyAny, len: usize, name: &str) -> PyResult> { use pyo3::exceptions::PyValueError; let s: String = o.extract()?; - let s = if s.starts_with("0x") { &s[2..] } else { &s[..] }; + let s = if let Some(st) = s.strip_prefix("0x") { + st + } else { + &s[..] + }; let buf = match hex::decode(s) { Err(_) => { return Err(PyValueError::new_err("invalid hex")); diff --git a/wheel/src/api.rs b/wheel/src/api.rs index fe8a27c64..1d4c81348 100644 --- a/wheel/src/api.rs +++ b/wheel/src/api.rs @@ -88,9 +88,10 @@ pub fn tree_hash(py: Python, blob: PyBuffer) -> PyResult<&PyBytes> { Ok(PyBytes::new(py, &tree_hash_from_stream(&mut input)?)) } +#[allow(clippy::too_many_arguments)] #[pyfunction] -pub fn get_puzzle_and_solution_for_coin<'py>( - py: Python<'py>, +pub fn get_puzzle_and_solution_for_coin( + py: Python<'_>, program: PyBuffer, args: PyBuffer, max_cost: Cost, @@ -98,7 +99,7 @@ pub fn get_puzzle_and_solution_for_coin<'py>( find_amount: u64, find_ph: Bytes32, flags: u32, -) -> PyResult<(&'py PyBytes, &'py PyBytes)> { +) -> PyResult<(&PyBytes, &PyBytes)> { let mut allocator = make_allocator(LIMIT_HEAP); if !program.is_c_contiguous() { @@ -158,8 +159,12 @@ fn run_puzzle( Ok(convert_spend_bundle_conds(&a, conds)) } -fn convert_list_of_tuples(spends: &PyAny) -> PyResult> { - let mut native_spends = Vec::<(Coin, &[u8], &[u8])>::new(); +// this is like a CoinSpend but with references to the puzzle and solution, +// rather than owning them +type CoinSpendRef<'a> = (Coin, &'a [u8], &'a [u8]); + +fn convert_list_of_tuples(spends: &PyAny) -> PyResult> { + let mut native_spends = Vec::::new(); for s in spends.iter()? { let tuple = s?.downcast::()?; let coin = tuple.get_item(0)?.extract::()?;