Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Rust nightly for llvm bug #1202

Merged
merged 5 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/rust/src/bin/gen-vk-libraries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const SUPPORTED_VKS: [(NoteType, u8, u8, u8); 7] = [
];

fn main() {
let srs = &*UNIVERSAL_PARAM;
let srs = &UNIVERSAL_PARAM;

for (note_type, num_input, num_output, tree_depth) in SUPPORTED_VKS {
// calculate the path to solidity file
Expand Down
2 changes: 1 addition & 1 deletion contracts/rust/src/cape/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ impl From<sol::CapeBlock> for CapeBlock {
}
}

#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct BlockWithMemos {
pub block: CapeBlock,
pub memos: BlockMemos,
Expand Down
2 changes: 1 addition & 1 deletion contracts/rust/src/cape_e2e_test_mint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async fn test_mint_maybe_submit(should_submit: bool) -> Result<()> {

let mut prng = ChaChaRng::from_seed([0x8au8; 32]);

let (prove_keys, verif_keys) = keysets_for_test(&*UNIVERSAL_PARAM);
let (prove_keys, verif_keys) = keysets_for_test(&UNIVERSAL_PARAM);

println!("CRS set up: {}s", now.elapsed().as_secs_f32());
let now = Instant::now();
Expand Down
2 changes: 1 addition & 1 deletion contracts/rust/src/cape_e2e_test_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async fn test_2user_maybe_submit(should_submit: bool) -> Result<()> {

let mut prng = ChaChaRng::from_seed([0x8au8; 32]);

let (prove_keys, verif_keys) = keysets_for_test(&*UNIVERSAL_PARAM);
let (prove_keys, verif_keys) = keysets_for_test(&UNIVERSAL_PARAM);

println!("CRS set up: {}s", now.elapsed().as_secs_f32());
let now = Instant::now();
Expand Down
5 changes: 3 additions & 2 deletions contracts/rust/src/ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use std::iter::repeat;
// * Some(false): definitely not in the set
// * None: outside the sparse domain of this set, query a full node for a definitive answer
#[ser_test(arbitrary, ark(false))]
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
pub struct CapeNullifierSet(HashMap<Nullifier, bool>);

impl CapeNullifierSet {
Expand Down Expand Up @@ -328,7 +328,8 @@ impl Ledger for CapeLedger {
CAPE_MERKLE_HEIGHT
}

#[allow(clippy::explicit_auto_deref)]
fn srs() -> &'static UniversalParam {
&*UNIVERSAL_PARAM
&UNIVERSAL_PARAM
}
}
2 changes: 1 addition & 1 deletion contracts/rust/src/plonk_verifier/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub(crate) fn gen_plonk_proof_for_test(
> {
// 1. Simulate universal setup
let rng = &mut test_rng();
let srs = &*UNIVERSAL_PARAM;
let srs = &UNIVERSAL_PARAM;

// 2. Create circuits
let circuits = (0..num_proof)
Expand Down
2 changes: 1 addition & 1 deletion contracts/rust/src/plonk_verifier/vk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async fn test_get_encoded_id() -> Result<()> {
#[tokio::test]
async fn test_get_vk_by_id() -> Result<()> {
let contract = deploy_test_verifying_keys_contract().await;
let srs = &*UNIVERSAL_PARAM;
let srs = &UNIVERSAL_PARAM;

for (note_type, num_input, num_output, tree_depth) in SUPPORTED_VKS {
// load rust vk
Expand Down
2 changes: 1 addition & 1 deletion contracts/rust/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ pub fn generate_burn_tx(
// 2 inputs: fee input record and wrapped asset record
// 2 outputs: changed fee asset record, burn output record
let xfr_prove_key =
jf_cap::proof::transfer::preprocess(&*UNIVERSAL_PARAM, 2, 2, CapeLedger::merkle_height())
jf_cap::proof::transfer::preprocess(&UNIVERSAL_PARAM, 2, 2, CapeLedger::merkle_height())
.unwrap()
.0;
let valid_until = 2u64.pow(jf_cap::constants::MAX_TIMESTAMP_LEN as u32) - 1;
Expand Down
2 changes: 1 addition & 1 deletion contracts/rust/src/universal_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub const SUPPORTED_FREEZE_SIZES: &[usize] = &[2, 3];
/// Compute the verifier keys for different types and sizes of CAP transactions.
pub fn verifier_keys() -> VerifierKeySet {
use TransactionVerifyingKey::*;
let univ_setup = &*UNIVERSAL_PARAM;
let univ_setup = &UNIVERSAL_PARAM;
let xfr_verif_keys = SUPPORTED_TRANSFER_SIZES.iter().map(|&(inputs, outputs)| {
Transfer(
jf_cap::proof::transfer::preprocess(univ_setup, inputs, outputs, CAPE_MERKLE_HEIGHT)
Expand Down
2 changes: 1 addition & 1 deletion doc/workflow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const CAPE_BURN_PREFIX_BYTES_LEN: usize = 12;
fn is_burn_txn(txn: &TransactionNote) -> bool {
match txn {
TransactionNote::Transfer(tx) => {
(*tx).aux_info.extra_proof_bound_data[0..CAPE_BURN_PREFIX_BYTES_LEN]
tx.aux_info.extra_proof_bound_data[0..CAPE_BURN_PREFIX_BYTES_LEN]
== *CAPE_BURN_PREFIX_BYTES.as_bytes()
}
TransactionNote::Mint(_) => false,
Expand Down
1 change: 1 addition & 0 deletions eqs/src/api_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

#![allow(clippy::format_push_string)]
use crate::configuration::EQSOptions;
use crate::errors::EQSNetError;
use crate::query_result_state::QueryResultState;
Expand Down
2 changes: 1 addition & 1 deletion eqs/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::{
};
use structopt::StructOpt;

#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, PartialOrd)]
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, PartialOrd)]
pub struct Confirmations(u64);

/// A number of Ethereum block confirmations. The minimum value is 1 which
Expand Down
1 change: 1 addition & 0 deletions eqs/src/disco.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

#![allow(clippy::format_push_string)]
use crate::{api_server::WebState, routes::check_api};
use std::fs::read_to_string;
use std::path::Path;
Expand Down
1 change: 1 addition & 0 deletions eqs/src/eth_polling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ impl EthPolling {

// persist the state block updates (will be more fine grained in r3)
if persist_state {
#[allow(clippy::explicit_auto_deref)]
self.state_persistence
.store_latest_state(&*self.query_result_state.read().await);
}
Expand Down
2 changes: 1 addition & 1 deletion faucet/src/bin/faucet-shower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async fn create_wallet(
CapeLoader::latest_contract(opt.eqs_url.clone()).await?,
);
let backend = CapeBackend::new(
&*UNIVERSAL_PARAM,
&UNIVERSAL_PARAM,
CapeBackendConfig {
// We're not going to do any direct-to-contract operations that
// would require a connection to the CAPE contract or an ETH
Expand Down
6 changes: 4 additions & 2 deletions faucet/src/faucet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,7 @@ async fn maintain_enough_records(state: FaucetState, mut wakeup: mpsc::Receiver<
// drop and reacquisition of the wallet mutex guard.
loop {
let wallet = state.wallet.lock().await;
#[allow(clippy::explicit_auto_deref)]
let records = spendable_records(&*wallet, state.grant_size)
.await
.collect::<Vec<_>>();
Expand Down Expand Up @@ -706,6 +707,7 @@ async fn break_up_records(state: &FaucetState) -> Option<Vec<TransactionReceipt<
// Holding the lock for too long can unneccessarily slow down faucet requests.
let mut wallet = state.wallet.lock().await;
let address = wallet.pub_keys().await[0].address();
#[allow(clippy::explicit_auto_deref)]
let records = spendable_records(&*wallet, state.grant_size)
.await
.collect::<Vec<_>>();
Expand Down Expand Up @@ -845,7 +847,7 @@ pub async fn init_web_server(
.unwrap(),
);
let backend = CapeBackend::new(
&*UNIVERSAL_PARAM,
&UNIVERSAL_PARAM,
CapeBackendConfig {
// We're not going to do any direct-to-contract operations that would require a
// connection to the CAPE contract or an ETH wallet. Everything we do will go through
Expand Down Expand Up @@ -1094,7 +1096,7 @@ mod test {

async fn parallel_request(num_requests: usize, restart: bool) {
let mut rng = ChaChaRng::from_seed([1u8; 32]);
let universal_param = &*UNIVERSAL_PARAM;
let universal_param = &UNIVERSAL_PARAM;

// Create test network with a faucet key pair.
let (key_stream, mnemonic) = KeyTree::random(&mut rng);
Expand Down
36 changes: 18 additions & 18 deletions flake.lock

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

17 changes: 8 additions & 9 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,10 @@
opensslMusl.dev
opensslMusl.out
];
stableMuslRustToolchain =
pkgs.rust-bin.stable."1.60.0".minimal.override {
extensions = [ "rustfmt" "clippy" "llvm-tools-preview" "rust-src" ];
targets = [ "x86_64-unknown-linux-musl" ];
};
nightlyMuslRustToolchain = pkgs.rust-bin.nightly."2022-07-17".minimal.override {
extensions = [ "rustfmt" "clippy" "llvm-tools-preview" "rust-src" ];
targets = [ "x86_64-unknown-linux-musl" ];
};

# glibc pkgs
overlays = [ (import rust-overlay) ];
Expand All @@ -59,7 +58,7 @@
pythonEnv = pkgs.poetry2nix.mkPoetryEnv { projectDir = ./.; };
myPython = with pkgs; [ poetry pythonEnv ];

stableRustToolchain = pkgs.rust-bin.stable."1.60.0".minimal.override {
nightlyRustToolchain = pkgs.rust-bin.nightly."2022-07-17".minimal.override {
extensions = [ "rustfmt" "clippy" "llvm-tools-preview" "rust-src" ];
};
rustDeps = with pkgs;
Expand All @@ -69,7 +68,7 @@

curl
plantuml
stableRustToolchain
nightlyRustToolchain

cargo-edit
cargo-sort
Expand Down Expand Up @@ -202,7 +201,7 @@
moreutils # includes `ts`, used to add timestamps on CI
] ++ myPython ++ rustDeps;

RUST_SRC_PATH = "${stableRustToolchain}/lib/rustlib/src/rust/library";
RUST_SRC_PATH = "${nightlyRustToolchain}/lib/rustlib/src/rust/library";
RUST_BACKTRACE = 1;
RUST_LOG = "info";

Expand Down Expand Up @@ -287,7 +286,7 @@
export PATH=''${my_pwd}/bin:$PATH
export WALLET=''${my_pwd}/wallet

export PATH="${pkgs.nodePackages.pnpm}/bin:${pkgs.nodejs-16_x}/bin:${stableMuslRustToolchain}/bin:${pkgs.gcc}/bin/:$PATH"
export PATH="${pkgs.nodePackages.pnpm}/bin:${pkgs.nodejs-16_x}/bin:${nightlyMuslRustToolchain}/bin:${pkgs.gcc}/bin/:$PATH"
'';
};
};
Expand Down
2 changes: 1 addition & 1 deletion relayer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ mod test {
receiver: UserPubKey,
records: &MerkleTree,
) -> (CapeModelTxn, Vec<ReceiverMemo>, Signature) {
let srs = &*UNIVERSAL_PARAM;
let srs = &UNIVERSAL_PARAM;
let xfr_prove_key =
jf_cap::proof::transfer::preprocess(srs, 1, 2, CapeLedger::merkle_height())
.unwrap()
Expand Down
4 changes: 2 additions & 2 deletions wallet/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ mod test {
#[async_std::test]
async fn test_transfer() {
let mut rng = ChaChaRng::from_seed([1u8; 32]);
let universal_param = &*UNIVERSAL_PARAM;
let universal_param = &UNIVERSAL_PARAM;
let (sender_key, relayer_url, address_book_url, contract_address, _) =
create_test_network(&mut rng, universal_param, None).await;
let (eqs_url, _eqs_dir, _join_eqs) = spawn_eqs(contract_address).await;
Expand Down Expand Up @@ -849,7 +849,7 @@ mod test {
#[async_std::test]
async fn test_anonymous_erc20_transfer() {
let mut rng = ChaChaRng::from_seed([1u8; 32]);
let universal_param = &*UNIVERSAL_PARAM;
let universal_param = &UNIVERSAL_PARAM;
let (wrapper_key, relayer_url, address_book_url, contract_address, _) =
create_test_network(&mut rng, universal_param, None).await;
let (eqs_url, _eqs_dir, _join_eqs) = spawn_eqs(contract_address).await;
Expand Down
2 changes: 1 addition & 1 deletion wallet/src/bin/official-asset-library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ impl GenerateCommand {
.map_err(wallet_error)?,
);
let backend = CapeBackend::new(
&*UNIVERSAL_PARAM,
&UNIVERSAL_PARAM,
CapeBackendConfig {
web3_provider: Some(self.rpc_url),
eth_mnemonic: Some(self.eth_mnemonic.to_string()),
Expand Down
2 changes: 1 addition & 1 deletion wallet/src/bin/random-wallet-in-mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ async fn main() {
let mut balances = HashMap::new();
let args = Args::from_args();
let mut rng = ChaChaRng::seed_from_u64(args.seed.unwrap_or(0));
let universal_param = &*UNIVERSAL_PARAM;
let universal_param = &UNIVERSAL_PARAM;
let tmp_dir = TempDir::new("random_in_mem_test_sender").unwrap();
tmp_dirs.push(tmp_dir);
let (network, mut wallet) = if args.demo_connection {
Expand Down
2 changes: 1 addition & 1 deletion wallet/src/bin/random-wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ async fn main() {

let mut rng = ChaChaRng::seed_from_u64(args.seed.unwrap_or(0));

let universal_param = &*UNIVERSAL_PARAM;
let universal_param = &UNIVERSAL_PARAM;

// Everyone creates own relayer and EQS, not sure it works without EQS
let (sender_key, relayer_url, address_book_url, contract_address, _) =
Expand Down
2 changes: 1 addition & 1 deletion wallet/src/bin/wallet-cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ async fn main() -> Result<(), std::io::Error> {

// It can take a little while to unpack the universal params. Start doing this in the background
// while the CLI is starting and the user is going through the login process.
async_std::task::spawn(async { &*UNIVERSAL_PARAM });
async_std::task::spawn(async { &UNIVERSAL_PARAM });

// Initialize the wallet CLI.
if let Err(err) = cli_main::<CapeLedger, CapeCli>(CapeArgs::from_args()).await {
Expand Down
4 changes: 2 additions & 2 deletions wallet/src/cli_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ impl CliClient {
}
}

return Err(format!(
Err(format!(
"regex \"{}\" did not match output:\n{}",
regex,
self.prev_output.join("\n")
));
))
}

pub fn last_output(&self) -> impl Iterator<Item = &String> {
Expand Down
Loading