From b7e48fa19df95f08dd24e23fcb9f9c9d7feea078 Mon Sep 17 00:00:00 2001
From: Blaine Bublitz <blaine.bublitz@gmail.com>
Date: Wed, 17 May 2023 15:55:16 -0700
Subject: [PATCH] fix: Allow async functions without send on async trait

---
 Cargo.lock                                  | 12 ++++--------
 Cargo.toml                                  |  3 +++
 src/acvm_interop/common_reference_string.rs |  2 +-
 src/composer.rs                             |  2 +-
 4 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index de104a3a..69a023bb 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5,8 +5,7 @@ version = 3
 [[package]]
 name = "acir"
 version = "0.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c831802bad8d6810bfdb57cd00913157dfe710a185dc360c9a94eecd043bbf12"
+source = "git+https://github.com/noir-lang/acvm?rev=8d6ecbf2fe180de5809f6e7cbf7b5110d8c9294d#8d6ecbf2fe180de5809f6e7cbf7b5110d8c9294d"
 dependencies = [
  "acir_field",
  "flate2",
@@ -18,8 +17,7 @@ dependencies = [
 [[package]]
 name = "acir_field"
 version = "0.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d455746f51b4421548e42d34e2ce46b6db637cb048095d78766612d26bf526db"
+source = "git+https://github.com/noir-lang/acvm?rev=8d6ecbf2fe180de5809f6e7cbf7b5110d8c9294d#8d6ecbf2fe180de5809f6e7cbf7b5110d8c9294d"
 dependencies = [
  "ark-bn254",
  "ark-ff",
@@ -32,8 +30,7 @@ dependencies = [
 [[package]]
 name = "acvm"
 version = "0.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd8e75cf737b52195a8c109e0ee776e468e1c2ec42f0f88aa4465cd76a09b4ed"
+source = "git+https://github.com/noir-lang/acvm?rev=8d6ecbf2fe180de5809f6e7cbf7b5110d8c9294d#8d6ecbf2fe180de5809f6e7cbf7b5110d8c9294d"
 dependencies = [
  "acir",
  "acvm_stdlib",
@@ -70,8 +67,7 @@ dependencies = [
 [[package]]
 name = "acvm_stdlib"
 version = "0.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a2e87549b987593eeb1902990006443f2fe5817db927035f081008e4b8a46a49"
+source = "git+https://github.com/noir-lang/acvm?rev=8d6ecbf2fe180de5809f6e7cbf7b5110d8c9294d#8d6ecbf2fe180de5809f6e7cbf7b5110d8c9294d"
 dependencies = [
  "acir",
 ]
diff --git a/Cargo.toml b/Cargo.toml
index 4ff06804..0a13ca2a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -57,3 +57,6 @@ js = [
     "dep:getrandom",
     "wasmer/js-default"
 ]
+
+[patch.crates-io]
+acvm = { git = "https://github.com/noir-lang/acvm", rev = "8d6ecbf2fe180de5809f6e7cbf7b5110d8c9294d" }
diff --git a/src/acvm_interop/common_reference_string.rs b/src/acvm_interop/common_reference_string.rs
index 2122ce00..a52c239a 100644
--- a/src/acvm_interop/common_reference_string.rs
+++ b/src/acvm_interop/common_reference_string.rs
@@ -3,7 +3,7 @@ use acvm::{acir::circuit::Circuit, async_trait, CommonReferenceString};
 use crate::{composer::Composer, BackendError, Barretenberg};
 
 // TODO(#185): Ensure CRS download works in JS
-#[async_trait]
+#[async_trait(?Send)]
 impl CommonReferenceString for Barretenberg {
     type Error = BackendError;
 
diff --git a/src/composer.rs b/src/composer.rs
index dcc772ef..6c1abf7f 100644
--- a/src/composer.rs
+++ b/src/composer.rs
@@ -6,7 +6,7 @@ use crate::{crs::CRS, Barretenberg, Error, FIELD_BYTES};
 
 const NUM_RESERVED_GATES: u32 = 4; // this must be >= num_roots_cut_out_of_vanishing_polynomial (found under prover settings in barretenberg)
 
-#[async_trait]
+#[async_trait(?Send)]
 pub(crate) trait Composer {
     fn get_circuit_size(&self, constraint_system: &ConstraintSystem) -> Result<u32, Error>;