Ver código fonte

Cargo.lock,sdk/python: port python bindings to pyo3 version 0.26

oars 9 meses atrás
pai
commit
99199786f7

+ 23 - 19
Cargo.lock

@@ -1433,7 +1433,7 @@ dependencies = [
  "regalloc2",
  "regalloc2",
  "rustc-hash 1.1.0",
  "rustc-hash 1.1.0",
  "smallvec",
  "smallvec",
- "target-lexicon",
+ "target-lexicon 0.12.16",
 ]
 ]
 
 
 [[package]]
 [[package]]
@@ -1478,7 +1478,7 @@ dependencies = [
  "cranelift-codegen",
  "cranelift-codegen",
  "log",
  "log",
  "smallvec",
  "smallvec",
- "target-lexicon",
+ "target-lexicon 0.12.16",
 ]
 ]
 
 
 [[package]]
 [[package]]
@@ -5328,11 +5328,10 @@ dependencies = [
 
 
 [[package]]
 [[package]]
 name = "pyo3"
 name = "pyo3"
-version = "0.22.6"
+version = "0.26.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f402062616ab18202ae8319da13fa4279883a2b8a9d9f83f20dbade813ce1884"
+checksum = "7ba0117f4212101ee6544044dae45abe1083d30ce7b29c4b5cbdfa2354e07383"
 dependencies = [
 dependencies = [
- "cfg-if",
  "indoc",
  "indoc",
  "libc",
  "libc",
  "memoffset",
  "memoffset",
@@ -5346,19 +5345,18 @@ dependencies = [
 
 
 [[package]]
 [[package]]
 name = "pyo3-build-config"
 name = "pyo3-build-config"
-version = "0.22.6"
+version = "0.26.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b14b5775b5ff446dd1056212d778012cbe8a0fbffd368029fd9e25b514479c38"
+checksum = "4fc6ddaf24947d12a9aa31ac65431fb1b851b8f4365426e182901eabfb87df5f"
 dependencies = [
 dependencies = [
- "once_cell",
- "target-lexicon",
+ "target-lexicon 0.13.3",
 ]
 ]
 
 
 [[package]]
 [[package]]
 name = "pyo3-ffi"
 name = "pyo3-ffi"
-version = "0.22.6"
+version = "0.26.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9ab5bcf04a2cdcbb50c7d6105de943f543f9ed92af55818fd17b660390fc8636"
+checksum = "025474d3928738efb38ac36d4744a74a400c901c7596199e20e45d98eb194105"
 dependencies = [
 dependencies = [
  "libc",
  "libc",
  "pyo3-build-config",
  "pyo3-build-config",
@@ -5366,9 +5364,9 @@ dependencies = [
 
 
 [[package]]
 [[package]]
 name = "pyo3-macros"
 name = "pyo3-macros"
-version = "0.22.6"
+version = "0.26.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0fd24d897903a9e6d80b968368a34e1525aeb719d568dba8b3d4bfa5dc67d453"
+checksum = "2e64eb489f22fe1c95911b77c44cc41e7c19f3082fc81cce90f657cdc42ffded"
 dependencies = [
 dependencies = [
  "proc-macro2",
  "proc-macro2",
  "pyo3-macros-backend",
  "pyo3-macros-backend",
@@ -5378,9 +5376,9 @@ dependencies = [
 
 
 [[package]]
 [[package]]
 name = "pyo3-macros-backend"
 name = "pyo3-macros-backend"
-version = "0.22.6"
+version = "0.26.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "36c011a03ba1e50152b4b394b479826cad97e7a21eb52df179cd91ac411cbfbe"
+checksum = "100246c0ecf400b475341b8455a9213344569af29a3c841d29270e53102e0fcf"
 dependencies = [
 dependencies = [
  "heck 0.5.0",
  "heck 0.5.0",
  "proc-macro2",
  "proc-macro2",
@@ -6713,6 +6711,12 @@ version = "0.12.16"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
 checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
 
 
+[[package]]
+name = "target-lexicon"
+version = "0.13.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "df7f62577c25e07834649fc3b39fafdc597c0a3527dc1c60129201ccfcbaa50c"
+
 [[package]]
 [[package]]
 name = "taud"
 name = "taud"
 version = "0.5.0"
 version = "0.5.0"
@@ -8461,7 +8465,7 @@ dependencies = [
  "serde-wasm-bindgen",
  "serde-wasm-bindgen",
  "shared-buffer",
  "shared-buffer",
  "tar",
  "tar",
- "target-lexicon",
+ "target-lexicon 0.12.16",
  "thiserror 1.0.69",
  "thiserror 1.0.69",
  "tracing",
  "tracing",
  "wasm-bindgen",
  "wasm-bindgen",
@@ -8498,7 +8502,7 @@ dependencies = [
  "self_cell",
  "self_cell",
  "shared-buffer",
  "shared-buffer",
  "smallvec",
  "smallvec",
- "target-lexicon",
+ "target-lexicon 0.12.16",
  "thiserror 1.0.69",
  "thiserror 1.0.69",
  "wasmer-types",
  "wasmer-types",
  "wasmer-vm",
  "wasmer-vm",
@@ -8521,7 +8525,7 @@ dependencies = [
  "more-asserts",
  "more-asserts",
  "rayon",
  "rayon",
  "smallvec",
  "smallvec",
- "target-lexicon",
+ "target-lexicon 0.12.16",
  "tracing",
  "tracing",
  "wasmer-compiler",
  "wasmer-compiler",
  "wasmer-types",
  "wasmer-types",
@@ -8583,7 +8587,7 @@ dependencies = [
  "more-asserts",
  "more-asserts",
  "rkyv",
  "rkyv",
  "sha2",
  "sha2",
- "target-lexicon",
+ "target-lexicon 0.12.16",
  "thiserror 1.0.69",
  "thiserror 1.0.69",
  "xxhash-rust",
  "xxhash-rust",
 ]
 ]

+ 1 - 1
src/sdk/python/Cargo.toml

@@ -19,7 +19,7 @@ darkfi-sdk = {path = "../"}
 halo2_proofs = {version = "0.3.1", features = ["circuit-params", "dev-graph", "sanity-checks"]}
 halo2_proofs = {version = "0.3.1", features = ["circuit-params", "dev-graph", "sanity-checks"]}
 halo2_gadgets = {version = "0.3.1", features = ["circuit-params"]}
 halo2_gadgets = {version = "0.3.1", features = ["circuit-params"]}
 plotters = "0.3.7"
 plotters = "0.3.7"
-pyo3 = {version = "0.22.6", features = ["gil-refs"]}
+pyo3 = "0.26.0"
 rand = "0.8.5"
 rand = "0.8.5"
 
 
 [lints]
 [lints]

+ 1 - 1
src/sdk/python/src/crypto.rs

@@ -68,7 +68,7 @@ pub fn pedersen_commitment_base(value: &Bound<Fp>, blind: &Bound<Fq>) -> Ep {
 
 
 /// Wrapper function for creating this Python module.
 /// Wrapper function for creating this Python module.
 pub(crate) fn create_module(py: Python<'_>) -> PyResult<Bound<PyModule>> {
 pub(crate) fn create_module(py: Python<'_>) -> PyResult<Bound<PyModule>> {
-    let submod = PyModule::new_bound(py, "crypto")?;
+    let submod = PyModule::new(py, "crypto")?;
     submod.add_function(wrap_pyfunction!(poseidon_hash, &submod)?)?;
     submod.add_function(wrap_pyfunction!(poseidon_hash, &submod)?)?;
     submod.add_function(wrap_pyfunction!(pedersen_commitment_u64, &submod)?)?;
     submod.add_function(wrap_pyfunction!(pedersen_commitment_u64, &submod)?)?;
     submod.add_function(wrap_pyfunction!(pedersen_commitment_base, &submod)?)?;
     submod.add_function(wrap_pyfunction!(pedersen_commitment_base, &submod)?)?;

+ 0 - 3
src/sdk/python/src/lib.rs

@@ -29,9 +29,6 @@ mod crypto;
 mod zkas;
 mod zkas;
 
 
 #[pyo3::prelude::pymodule]
 #[pyo3::prelude::pymodule]
-// We allow unexpected configs here since `pyo3::py_run!` macro
-// uses `#[cfg(feature = "gil-refs")]`.
-#[allow(unexpected_cfgs)]
 fn darkfi_sdk(
 fn darkfi_sdk(
     py: pyo3::Python<'_>,
     py: pyo3::Python<'_>,
     m: &pyo3::Bound<'_, pyo3::prelude::PyModule>,
     m: &pyo3::Bound<'_, pyo3::prelude::PyModule>,

+ 1 - 1
src/sdk/python/src/merkle.rs

@@ -58,7 +58,7 @@ impl MerkleTree {
 
 
 /// Wrapper function for creating this Python module.
 /// Wrapper function for creating this Python module.
 pub(crate) fn create_module(py: pyo3::Python<'_>) -> PyResult<Bound<PyModule>> {
 pub(crate) fn create_module(py: pyo3::Python<'_>) -> PyResult<Bound<PyModule>> {
-    let submod = PyModule::new_bound(py, "merkle")?;
+    let submod = PyModule::new(py, "merkle")?;
     submod.add_class::<MerkleTree>()?;
     submod.add_class::<MerkleTree>()?;
     Ok(submod)
     Ok(submod)
 }
 }

+ 1 - 1
src/sdk/python/src/pasta.rs

@@ -295,7 +295,7 @@ pub fn fp_mod_fv(x: &Bound<Fp>) -> Fq {
 }
 }
 
 
 pub fn create_module(py: pyo3::Python<'_>) -> PyResult<Bound<PyModule>> {
 pub fn create_module(py: pyo3::Python<'_>) -> PyResult<Bound<PyModule>> {
-    let submod = PyModule::new_bound(py, "pasta")?;
+    let submod = PyModule::new(py, "pasta")?;
 
 
     submod.add_class::<Fp>()?;
     submod.add_class::<Fp>()?;
     submod.add_class::<Fq>()?;
     submod.add_class::<Fq>()?;

+ 3 - 3
src/sdk/python/src/zkas.rs

@@ -185,8 +185,8 @@ impl ZkCircuit {
     }
     }
 
 
     fn opvalues(&self) -> Vec<(DebugOpValue, Vec<Fp>)> {
     fn opvalues(&self) -> Vec<(DebugOpValue, Vec<Fp>)> {
-        let opvalue_binding = self.0.tracer.opvalues.borrow();
-        let opvalues = opvalue_binding.as_ref().unwrap();
+        let opvalue_guard = self.0.tracer.opvalues.lock().unwrap();
+        let opvalues = opvalue_guard.as_ref().unwrap();
         let mut result = Vec::new();
         let mut result = Vec::new();
         for opvalue in opvalues {
         for opvalue in opvalues {
             match opvalue {
             match opvalue {
@@ -355,7 +355,7 @@ impl MockProver {
 }
 }
 
 
 pub fn create_module(py: Python<'_>) -> PyResult<Bound<PyModule>> {
 pub fn create_module(py: Python<'_>) -> PyResult<Bound<PyModule>> {
-    let submod = PyModule::new_bound(py, "zkas")?;
+    let submod = PyModule::new(py, "zkas")?;
 
 
     submod.add_class::<ZkBinary>()?;
     submod.add_class::<ZkBinary>()?;
     submod.add_class::<ZkCircuit>()?;
     submod.add_class::<ZkCircuit>()?;