From 278ff4bc09cd90820b1dc531a78693ffaf7e572d Mon Sep 17 00:00:00 2001 From: German Date: Mon, 19 Dec 2022 15:26:35 +0000 Subject: [PATCH] Add determinism arg to upload TX (#870) * add determinism arg to upload tx * apply clippy suggestions --- crates/build/src/tests.rs | 6 +++--- crates/build/src/util/tests.rs | 2 +- .../runtime_api/contracts_runtime.scale | Bin 70033 -> 73846 bytes .../src/cmd/extrinsics/upload.rs | 12 +++++++++--- crates/cargo-contract/tests/decode.rs | 2 +- crates/transcode/src/decode.rs | 2 +- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/crates/build/src/tests.rs b/crates/build/src/tests.rs index 1c333ad7a..19cd54a75 100644 --- a/crates/build/src/tests.rs +++ b/crates/build/src/tests.rs @@ -109,7 +109,7 @@ fn build_code_only(manifest_path: &ManifestPath) -> Result<()> { // we specified that debug symbols should be removed // original code should have some but the optimized version should have them removed - assert!(!has_debug_symbols(&res.dest_wasm.unwrap())); + assert!(!has_debug_symbols(res.dest_wasm.unwrap())); Ok(()) } @@ -341,7 +341,7 @@ fn keep_debug_symbols_in_debug_mode(manifest_path: &ManifestPath) -> Result<()> let res = super::execute(args).expect("build failed"); // we specified that debug symbols should be kept - assert!(has_debug_symbols(&res.dest_wasm.unwrap())); + assert!(has_debug_symbols(res.dest_wasm.unwrap())); Ok(()) } @@ -359,7 +359,7 @@ fn keep_debug_symbols_in_release_mode(manifest_path: &ManifestPath) -> Result<() let res = super::execute(args).expect("build failed"); // we specified that debug symbols should be kept - assert!(has_debug_symbols(&res.dest_wasm.unwrap())); + assert!(has_debug_symbols(res.dest_wasm.unwrap())); Ok(()) } diff --git a/crates/build/src/util/tests.rs b/crates/build/src/util/tests.rs index 1e143752d..e42ec45a4 100644 --- a/crates/build/src/util/tests.rs +++ b/crates/build/src/util/tests.rs @@ -107,7 +107,7 @@ pub fn create_executable(path: &Path, content: &str) -> MockGuard { } pathes }; - env::set_var("PATH", env::join_paths(&env_paths).unwrap()); + env::set_var("PATH", env::join_paths(env_paths).unwrap()); guard } diff --git a/crates/cargo-contract/src/cmd/extrinsics/runtime_api/contracts_runtime.scale b/crates/cargo-contract/src/cmd/extrinsics/runtime_api/contracts_runtime.scale index 89dcafa19e92123a7a522c04c643a00bcb1b8378..c3394f49111d78fc0d878c1c93c6573a7781e6b6 100644 GIT binary patch delta 8755 zcmcIqdw3L8mcOUF0ttE0Kmr|-K!qfbgrp6RKt#l3A(&tyj{t(eq$}MwNlSNC=&B}Z zM{RXx9GH*=l*qKH1p2zdG^7O7fZAer4U@LSY02$0Oy%CWaY3+0b%tM zR{^kXcz2iylMVwo&EtjTF!FaWeL3~bzKKScE5QhzLnM|}T$cJ8$aeD_lE79J-vmR< zr;3MzbExzbTR1V39htl)oe;-vvYQYov8;@|hHqu$O{SHsf`jajB?Wl@yrgvcQIY~~ zRSSod;8Bp45-8EyXjtK*iMQm36xFX7S~x03kfTT>gSC{-9(Non7Pj%Bvu~k+mR4g9 z0UX@XXlRBKJkIu%W~G0B2szHql;*=*f=aO`9o}X)crx*h+hO;4rojpJThDdyA^Xy^ z1wLY3*UX;sk(4r5YnP;@aEeIe6e0X_oFQj8b7x)TEFsQBY)vHR2uYC01v8=Sm;(h` zxxJK0(?&vqIcC~X2PCmgTW4gXg4BQ$Nd|zMOL6HOLQ>hZ8P^Ow3l(*mZ!NoR=D2jo z4pT+fRDA?M_7dwSE1QwQcFvfPlmWPYDv(URLPm~FFt;DU9F{Y4>d3R%|DpsH)knci z5+O0*Kg*Pvg-N-5dJd2R7M!2S-kmuPidgrY@lbA#tJolkmrS;Mb`q4cKg`a?=Kr4k zC|J!yT>N;&hwqs)#%jm8?EDR%SYym@D~~vBDwW+s*{AcK!MBI16)0t2Ro_%R1?_HC zq~bbxYS|i;11ZJr4B0@Y;KPYlgJLY_EpBox?r$G-u(BI-z+=|m_#(jdg5xTiIQ?C8pTh_Y92o59jn+&f5XHl505t&D!J zXB}(4bv2~0eYX}`^T(C=sX@ab^r?F2PJohmeXqp1$jn={7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G4U&0pJ4n8=xHczy<@P zgZs!!2Kc)n3=99S6W9{i6$VqFFYv1{=n8!Xy)yEFK@;Q#1QV3P&LjIw&}M`e0x?nG zhyK8(D7a|z18j|F8=RfI%kSY2!7~xqHQ^5e-;9Pyy#^f49ETn8B0|3Q0KVf03B%L= zbRx1O5i*oc$Rw5j79oGh1CodWAC4#F=h$q$kKo88Wa<<`DpAMd-y0y$V$l8-;Ts4d z!XpSOPMv=XVHUzogcS(8EToqxIQTunFA@3?t_I&j_(lfea1e4Lm5}S%guI5%G{@=? zh40x2I}kb$UPTAO5bk>;RCSkJ9DY$f1|;{*1KPW-JxraFH;n3%3E6o}J<_O#({CWR{VTZrx+jP8Nn_-9YQL;8tf^#d|oTCos z6-?AH?-y%Ra{kuSVXA#ns5?Xs#)N1L|2p$C&DCi-A8vt$CRO`3$EYLW+A)o84dOeG z9?@2~AX4WO{Xfy>FKXO`d^!8L#xLdT^qTaw>VGQ86I-t*s`kmc=;PYb2Z}m1LdNek zdGc0$WuZ#Hq5DM)`a;Rj*CSLknHw|^^=Gp-KNWP~(VdzavPVB@B1|?6!MlO06QR!V0sJ9Qkq9>p7hy4ls|kU6J6J6=;X7Q&Dq*azkVIe=GIE=UOM::AccountId, code: Vec, storage_deposit_limit: Option, + determinism: Determinism, } #[derive(serde::Serialize)] diff --git a/crates/cargo-contract/tests/decode.rs b/crates/cargo-contract/tests/decode.rs index 8e21d408d..ed4b6920d 100644 --- a/crates/cargo-contract/tests/decode.rs +++ b/crates/cargo-contract/tests/decode.rs @@ -69,7 +69,7 @@ fn decode_works() { let project_dir = tmp_dir.path().to_path_buf().join("switcher"); let lib = project_dir.join("lib.rs"); - std::fs::write(&lib, contract).expect("Failed to write contract lib.rs"); + std::fs::write(lib, contract).expect("Failed to write contract lib.rs"); tracing::debug!("Building contract in {}", project_dir.to_string_lossy()); cargo_contract(&project_dir).arg("build").assert().success(); diff --git a/crates/transcode/src/decode.rs b/crates/transcode/src/decode.rs index 205bbfc7a..1fc9593f7 100644 --- a/crates/transcode/src/decode.rs +++ b/crates/transcode/src/decode.rs @@ -92,7 +92,7 @@ impl<'a> Decoder<'a> { })?; let mut elems = Vec::new(); - while elems.len() < len as usize { + while elems.len() < len { let elem = self.decode_type(type_id, ty, input)?; elems.push(elem) }