diff --git a/detectors/reentrancy-2/src/lib.rs b/detectors/reentrancy-2/src/lib.rs index 454a7a1d..4f0c0ad3 100644 --- a/detectors/reentrancy-2/src/lib.rs +++ b/detectors/reentrancy-2/src/lib.rs @@ -1,26 +1,24 @@ #![feature(rustc_private)] -extern crate rustc_abi; extern crate rustc_ast; extern crate rustc_hir; extern crate rustc_middle; extern crate rustc_span; extern crate rustc_target; -extern crate rustc_type_ir; use std::collections::{HashMap, HashSet}; +use clippy_wrappers::span_lint_and_help; use if_chain::if_chain; use rustc_ast::ast::LitKind; -use rustc_hir::def::Res; -use rustc_hir::intravisit::{walk_expr, FnKind}; -use rustc_hir::intravisit::{walk_local, Visitor}; -use rustc_hir::{Body, FnDecl, HirId, Local, PatKind, QPath}; -use rustc_hir::{Expr, ExprKind}; +use rustc_hir::{ + def::Res, + intravisit::{walk_expr, walk_local, FnKind, Visitor}, + Body, Expr, ExprKind, FnDecl, HirId, Local, PatKind, QPath, +}; use rustc_lint::{LateContext, LateLintPass}; use rustc_middle::ty::TyKind; -use rustc_span::def_id::LocalDefId; -use rustc_span::{Span, Symbol}; +use rustc_span::{def_id::LocalDefId, Span, Symbol}; use rustc_target::abi::VariantIdx; const LINT_MESSAGE:&str = "External calls could open the opportunity for a malicious contract to execute any arbitrary code"; @@ -105,190 +103,181 @@ const INSERT: &str = "insert"; const MAPPING: &str = "Mapping"; const ACCOUNT_ID: &str = "AccountId"; const U128: &str = "u128"; +const CALL_FLAGS: &str = "call_flags"; +const ALLOW_REENTRY: &str = "ALLOW_REENTRY"; -impl<'tcx> LateLintPass<'tcx> for Reentrancy2 { - fn check_fn( - &mut self, - cx: &LateContext<'tcx>, - _: FnKind<'tcx>, - _: &'tcx FnDecl<'_>, - body: &'tcx Body<'_>, - _: Span, - _: LocalDefId, - ) { - struct ReentrancyVisitor<'a, 'tcx: 'a> { - cx: &'a LateContext<'tcx>, - contracts_tainted_for_reentrancy: HashSet, - current_method_call: Option, - bool_var_values: HashMap, - reentrancy_spans: Vec, - should_look_for_insert: bool, - has_insert_operation: bool, - } +struct ReentrancyVisitor<'a, 'tcx> { + cx: &'a LateContext<'tcx>, + tainted_contracts: HashSet, + current_method: Option, + bool_values: HashMap, + reentrancy_spans: Vec, + looking_for_insert: bool, + found_insert: bool, +} - // This function is called whenever a contract is identified as potentially susceptible to reentrancy. - fn set_tainted_contract(visitor: &mut ReentrancyVisitor) { - if let Some(method_calls) = &visitor.current_method_call { - visitor - .contracts_tainted_for_reentrancy - .insert(*method_calls); - visitor.current_method_call = None; - } +impl<'a, 'tcx> ReentrancyVisitor<'a, 'tcx> { + fn mark_current_as_tainted(&mut self) { + if let Some(method) = self.current_method.take() { + self.tainted_contracts.insert(method); } + } - fn handle_set_allow_reentry(visitor: &mut ReentrancyVisitor, args: &&[Expr<'_>]) { - match &args[0].kind { - ExprKind::Lit(lit) => { - // If the argument is a boolean literal and it's true, call set_tainted_contract - if let LitKind::Bool(value) = lit.node { - if value { - set_tainted_contract(visitor); - } - } - } - ExprKind::Path(qpath) => { - // If the argument is a local variable, check if it's a boolean and if it's true - if_chain! { - if let res = visitor.cx.qpath_res(qpath, args[0].hir_id); - if let Res::Local(_) = res; - if let QPath::Resolved(_, path) = qpath; - then { - for path_segment in path.segments { - // If the argument is a known boolean variable, check if it's true - if let Res::Local(hir_id) = path_segment.res { - if visitor.bool_var_values.get(&hir_id).map_or(true, |v| *v) { - set_tainted_contract(visitor); - } - } + fn handle_set_allow_reentry(&mut self, args: &[Expr<'_>]) { + let is_reentry_enabled = match &args[0].kind { + ExprKind::Lit(lit) => matches!(lit.node, LitKind::Bool(true)), + ExprKind::Path(qpath) => { + if_chain! { + if let res = self.cx.qpath_res(qpath, args[0].hir_id); + if let Res::Local(_) = res; + if let QPath::Resolved(_, path) = qpath; + then { + path.segments.iter().any(|segment| { + if let Res::Local(hir_id) = segment.res { + self.bool_values.get(&hir_id).copied().unwrap_or(true) + } else { + false } - } + }) + } else { + false } } - _ => (), } + _ => false, + }; + + if is_reentry_enabled { + self.mark_current_as_tainted(); } + } - fn handle_invoke_contract( - visitor: &mut ReentrancyVisitor, - args: &&[Expr<'_>], - expr: &Expr<'_>, - ) { - if_chain! { - if let ExprKind::AddrOf(_, _, invoke_expr) = &args[0].kind; - if let ExprKind::Path(qpath) = &invoke_expr.kind; - if let QPath::Resolved(_, path) = qpath; - then{ - for path_segment in path.segments { - // If the argument is a tainted contract, add the span of this expression to the span vector - if visitor.contracts_tainted_for_reentrancy.contains(&path_segment.ident.name) { - visitor.should_look_for_insert = true; - visitor.reentrancy_spans.push(expr.span); - } + fn handle_invoke_contract(&mut self, args: &[Expr<'_>], expr: &Expr<'_>) { + if_chain! { + if let ExprKind::AddrOf(_, _, invoke_expr) = &args[0].kind; + if let ExprKind::Path(qpath) = &invoke_expr.kind; + if let QPath::Resolved(_, path) = qpath; + then { + for segment in path.segments.iter() { + if self.tainted_contracts.contains(&segment.ident.name) { + self.looking_for_insert = true; + self.reentrancy_spans.push(expr.span); } } } } + } - fn handle_insert(visitor: &mut ReentrancyVisitor, expr: &Expr<'_>) { - if_chain! { - if let ExprKind::MethodCall(_, expr1, _, _) = &expr.kind; - if let object_type = visitor.cx.typeck_results().expr_ty(expr1); - if let TyKind::Adt(adt_def, substs) = object_type.kind(); - if let Some(variant) = adt_def.variants().get(VariantIdx::from_u32(0)); - if variant.name.as_str() == MAPPING; - if let mut has_account_id = false; - if let mut has_u128 = false; - then{ - substs.types().for_each(|inner_type| { - let str_inner_type = inner_type.to_string(); - if str_inner_type.contains(ACCOUNT_ID) { - has_account_id = true; - } else if str_inner_type.contains(U128) { - has_u128 = true; - } - }); - visitor.has_insert_operation = has_account_id && has_u128; - } + fn handle_call_flags(&mut self, args: &[Expr<'_>]) { + if_chain! { + if let ExprKind::Path(qpath) = &args[0].kind; + if let QPath::TypeRelative(_, segment) = qpath; + if segment.ident.name.as_str() == ALLOW_REENTRY; + then { + self.mark_current_as_tainted(); } } + } - impl<'a, 'tcx> Visitor<'tcx> for ReentrancyVisitor<'a, 'tcx> { - fn visit_local(&mut self, local: &'tcx Local<'tcx>) { - if let Some(init) = &local.init { - if let PatKind::Binding(_, _, ident, _) = &local.pat.kind { - match &init.kind { - // Check if the variable being declared is a boolean, if so, add it to the bool_declarations hashmap - ExprKind::Lit(lit) => { - if let LitKind::Bool(value) = lit.node { - self.bool_var_values.insert(local.pat.hir_id, value); - } - } - ExprKind::MethodCall(_, _, _, _) => { - self.current_method_call = Some(ident.name); - } - // Check if the variable being declared is a boolean, if so, add it to the bool_declarations hashmap - ExprKind::Path(QPath::Resolved(_, path)) => { - if let Some(segment) = path.segments.last() { - if let Res::Local(hir_id) = segment.res { - if let Some(value) = self.bool_var_values.get(&hir_id) { - self.bool_var_values.insert(local.pat.hir_id, *value); - } - } + fn handle_insert(&mut self, expr: &Expr<'_>) { + if_chain! { + if let ExprKind::MethodCall(_, receiver, _, _) = &expr.kind; + if let object_type = self.cx.typeck_results().expr_ty(receiver); + if let TyKind::Adt(adt_def, substs) = object_type.kind(); + if let Some(variant) = adt_def.variants().get(VariantIdx::from_u32(0)); + if variant.name.as_str() == MAPPING; + then { + let mut has_account_id = false; + let mut has_u128 = false; + + substs.types().for_each(|ty| { + let type_str = ty.to_string(); + has_account_id |= type_str.contains(ACCOUNT_ID); + has_u128 |= type_str.contains(U128); + }); + + self.found_insert = has_account_id && has_u128; + } + } + } +} + +impl<'a, 'tcx> Visitor<'tcx> for ReentrancyVisitor<'a, 'tcx> { + fn visit_local(&mut self, local: &'tcx Local<'tcx>) { + if let Some(init) = &local.init { + if let PatKind::Binding(_, _, ident, _) = &local.pat.kind { + match &init.kind { + ExprKind::Lit(lit) => { + if let LitKind::Bool(value) = lit.node { + self.bool_values.insert(local.pat.hir_id, value); + } + } + ExprKind::MethodCall(_, _, _, _) => { + self.current_method = Some(ident.name); + } + ExprKind::Path(QPath::Resolved(_, path)) => { + if let Some(segment) = path.segments.last() { + if let Res::Local(hir_id) = segment.res { + if let Some(&value) = self.bool_values.get(&hir_id) { + self.bool_values.insert(local.pat.hir_id, value); } } - _ => (), } } - walk_local(self, local); + _ => (), } } + } + walk_local(self, local); + } - // This method is called for every expression. - fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) { - if let ExprKind::MethodCall(func, _, args, _) = &expr.kind { - let function_name = func.ident.name.as_str(); - match function_name { - // The function "set_allow_reentry" is being called - SET_ALLOW_REENTRY => handle_set_allow_reentry(self, args), - // The function "invoke_contract" is being called - INVOKE_CONTRACT => handle_invoke_contract(self, args, expr), - // The function "insert" is being called - INSERT => { - if self.should_look_for_insert { - handle_insert(self, expr) - } - } - _ => (), - } - } - walk_expr(self, expr) + fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) { + if let ExprKind::MethodCall(func, _, args, _) = &expr.kind { + match func.ident.name.as_str() { + SET_ALLOW_REENTRY => self.handle_set_allow_reentry(args), + CALL_FLAGS => self.handle_call_flags(args), + INVOKE_CONTRACT => self.handle_invoke_contract(args, expr), + INSERT if self.looking_for_insert => self.handle_insert(expr), + _ => (), } } + walk_expr(self, expr); + } +} - // The main function where we start the visitor to traverse the AST. - let mut reentrancy_visitor = ReentrancyVisitor { +impl<'tcx> LateLintPass<'tcx> for Reentrancy2 { + fn check_fn( + &mut self, + cx: &LateContext<'tcx>, + _: FnKind<'tcx>, + _: &'tcx FnDecl<'_>, + body: &'tcx Body<'_>, + _: Span, + _: LocalDefId, + ) { + let mut visitor = ReentrancyVisitor { cx, - contracts_tainted_for_reentrancy: HashSet::new(), - current_method_call: None, - bool_var_values: HashMap::new(), + tainted_contracts: HashSet::new(), + current_method: None, + bool_values: HashMap::new(), reentrancy_spans: Vec::new(), - has_insert_operation: false, - should_look_for_insert: false, + looking_for_insert: false, + found_insert: false, }; - walk_expr(&mut reentrancy_visitor, body.value); + walk_expr(&mut visitor, body.value); - // Iterate over all potential reentrancy spans and emit a warning for each. - if reentrancy_visitor.has_insert_operation { - reentrancy_visitor.reentrancy_spans.into_iter().for_each(|span| { - clippy_wrappers::span_lint_and_help( + if visitor.found_insert { + for span in visitor.reentrancy_spans { + span_lint_and_help( cx, REENTRANCY_2, span, LINT_MESSAGE, None, - "This statement seems to call another contract after the flag set_allow_reentry was enabled [todo: check state changes after this statement]" + "This statement seems to call another contract after the flag \ + set_allow_reentry was enabled [todo: check state changes after this statement]", ); - }) + } } } } diff --git a/test-cases/Cargo.toml b/test-cases/Cargo.toml index 2911d2c2..9fe5b7f7 100755 --- a/test-cases/Cargo.toml +++ b/test-cases/Cargo.toml @@ -4,11 +4,13 @@ members = ["*/*/*-example"] resolver = "2" [workspace.dependencies] +getrandom = { version = "0.2" } ink = { version = "5.0.0", default-features = false } -scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive"] } -scale-info = { version = "2.6", default-features = false, features = ["derive"] } ink_e2e = { version = "=5.0.0" } -getrandom = { version = "0.2" } +scale = { package = "parity-scale-codec", version = "3", default-features = false, features = [ + "derive", +] } +scale-info = { version = "2.6", default-features = false, features = ["derive"] } [profile.release] codegen-units = 1 diff --git a/test-cases/assert-violation/assert-violation-1/remediated-example/Cargo.toml b/test-cases/assert-violation/assert-violation-1/remediated-example/Cargo.toml index 9e026b9f..7b22eb57 100755 --- a/test-cases/assert-violation/assert-violation-1/remediated-example/Cargo.toml +++ b/test-cases/assert-violation/assert-violation-1/remediated-example/Cargo.toml @@ -1,27 +1,19 @@ [package] -name = "assert_violation_remediated-1" -version = "0.1.0" -authors = ["[your_name] <[your_email]>"] edition = "2021" +name = "assert-violation-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] +getrandom = { workspace = true, features = ["js"] } ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } -getrandom = { workspace = true, features = ["js"]} - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/assert-violation/assert-violation-1/vulnerable-example/Cargo.toml b/test-cases/assert-violation/assert-violation-1/vulnerable-example/Cargo.toml index 6aba953a..f098ac39 100755 --- a/test-cases/assert-violation/assert-violation-1/vulnerable-example/Cargo.toml +++ b/test-cases/assert-violation/assert-violation-1/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "assert_violation_vulnerable-1" -version = "0.1.0" -authors = ["[your_name] <[your_email]>"] edition = "2021" +name = "assert-violation-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/avoid-autokey-upgradable/avoid-autokey-upgradable-1/remediated-example/Cargo.toml b/test-cases/avoid-autokey-upgradable/avoid-autokey-upgradable-1/remediated-example/Cargo.toml index 50ad6f84..b9028eb4 100755 --- a/test-cases/avoid-autokey-upgradable/avoid-autokey-upgradable-1/remediated-example/Cargo.toml +++ b/test-cases/avoid-autokey-upgradable/avoid-autokey-upgradable-1/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "remediated-avoid-autokey-upgradable-remediated-1" -version = "0.1.0" -authors = ["[your_name] <[your_email]>"] edition = "2021" +name = "avoid-autokey-upgradable-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/avoid-autokey-upgradable/avoid-autokey-upgradable-1/vulnerable-example/Cargo.toml b/test-cases/avoid-autokey-upgradable/avoid-autokey-upgradable-1/vulnerable-example/Cargo.toml index a772d63c..d18216d4 100755 --- a/test-cases/avoid-autokey-upgradable/avoid-autokey-upgradable-1/vulnerable-example/Cargo.toml +++ b/test-cases/avoid-autokey-upgradable/avoid-autokey-upgradable-1/vulnerable-example/Cargo.toml @@ -1,28 +1,18 @@ [package] -name = "vulnerable-avoid-autokey-upgradable-vulnerable-1" -version = "0.1.0" -authors = ["[your_name] <[your_email]>"] edition = "2021" +name = "avoid-autokey-upgradable-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } - - diff --git a/test-cases/avoid-core-mem-forget/avoid-core-mem-forget-1/remediated-example/Cargo.toml b/test-cases/avoid-core-mem-forget/avoid-core-mem-forget-1/remediated-example/Cargo.toml index 0e30d923..a42c4cc4 100755 --- a/test-cases/avoid-core-mem-forget/avoid-core-mem-forget-1/remediated-example/Cargo.toml +++ b/test-cases/avoid-core-mem-forget/avoid-core-mem-forget-1/remediated-example/Cargo.toml @@ -1,27 +1,18 @@ [package] -name = "avoid_core_mem_forget-remediated-1" -version = "0.1.0" -authors = ["[your_name] <[your_email]>"] edition = "2021" +name = "avoid-core-mem-forget-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } - diff --git a/test-cases/avoid-core-mem-forget/avoid-core-mem-forget-1/vulnerable-example/Cargo.toml b/test-cases/avoid-core-mem-forget/avoid-core-mem-forget-1/vulnerable-example/Cargo.toml index 30114ae8..3bf5a06a 100755 --- a/test-cases/avoid-core-mem-forget/avoid-core-mem-forget-1/vulnerable-example/Cargo.toml +++ b/test-cases/avoid-core-mem-forget/avoid-core-mem-forget-1/vulnerable-example/Cargo.toml @@ -1,27 +1,18 @@ [package] -name = "avoid_core_mem_forget-vulnerable-1" -version = "0.1.0" -authors = ["[your_name] <[your_email]>"] edition = "2021" +name = "avoid-core-mem-forget-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } - diff --git a/test-cases/avoid-format-string/avoid-format-string-1/remediated-example/Cargo.toml b/test-cases/avoid-format-string/avoid-format-string-1/remediated-example/Cargo.toml index c9b5321d..b66e2724 100755 --- a/test-cases/avoid-format-string/avoid-format-string-1/remediated-example/Cargo.toml +++ b/test-cases/avoid-format-string/avoid-format-string-1/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "avoid_format-remediated-1" -version = "0.1.0" -authors = ["[your_name] <[your_email]>"] edition = "2021" +name = "avoid-format-string-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/avoid-format-string/avoid-format-string-1/vulnerable-example/Cargo.toml b/test-cases/avoid-format-string/avoid-format-string-1/vulnerable-example/Cargo.toml index 86b2e6a0..a5770b3f 100755 --- a/test-cases/avoid-format-string/avoid-format-string-1/vulnerable-example/Cargo.toml +++ b/test-cases/avoid-format-string/avoid-format-string-1/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "avoid_format-vulnerable-1" -version = "0.1.0" -authors = ["[your_name] <[your_email]>"] edition = "2021" +name = "avoid-format-string-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/avoid-unsafe-block/avoid-unsafe-block-1/remediated-example/Cargo.toml b/test-cases/avoid-unsafe-block/avoid-unsafe-block-1/remediated-example/Cargo.toml index 138451af..5a9430d7 100755 --- a/test-cases/avoid-unsafe-block/avoid-unsafe-block-1/remediated-example/Cargo.toml +++ b/test-cases/avoid-unsafe-block/avoid-unsafe-block-1/remediated-example/Cargo.toml @@ -1,32 +1,18 @@ [package] +edition = "2021" name = "avoid-unsafe-block-remediated-1" version = "0.1.0" -authors = ["[your_name] <[your_email]>"] -edition = "2021" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } - -[profile.release] -overflow-checks = false - -[profile.dev] -overflow-checks = false diff --git a/test-cases/avoid-unsafe-block/avoid-unsafe-block-1/vulnerable-example/Cargo.toml b/test-cases/avoid-unsafe-block/avoid-unsafe-block-1/vulnerable-example/Cargo.toml index fa38722a..a6a6a975 100755 --- a/test-cases/avoid-unsafe-block/avoid-unsafe-block-1/vulnerable-example/Cargo.toml +++ b/test-cases/avoid-unsafe-block/avoid-unsafe-block-1/vulnerable-example/Cargo.toml @@ -1,33 +1,18 @@ [package] +edition = "2021" name = "avoid-unsafe-block-vulnerable-1" version = "0.1.0" -authors = ["[your_name] <[your_email]>"] -edition = "2021" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } - -[profile.release] -overflow-checks = false - -[profile.dev] -overflow-checks = false - diff --git a/test-cases/buffering-unsized-types/buffering-unsized-types-1/remediated-example/Cargo.toml b/test-cases/buffering-unsized-types/buffering-unsized-types-1/remediated-example/Cargo.toml index db2cb955..5eb24728 100755 --- a/test-cases/buffering-unsized-types/buffering-unsized-types-1/remediated-example/Cargo.toml +++ b/test-cases/buffering-unsized-types/buffering-unsized-types-1/remediated-example/Cargo.toml @@ -1,32 +1,18 @@ [package] -name = "buffering-unsized-types-remediated" -version = "0.1.0" -authors = ["[your_name] <[your_email]>"] edition = "2021" +name = "buffering-unsized-types-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } - -[profile.release] -overflow-checks = false - -[profile.dev] -overflow-checks = false diff --git a/test-cases/buffering-unsized-types/buffering-unsized-types-1/vulnerable-example/Cargo.toml b/test-cases/buffering-unsized-types/buffering-unsized-types-1/vulnerable-example/Cargo.toml index 12ce0cf0..959e88e3 100755 --- a/test-cases/buffering-unsized-types/buffering-unsized-types-1/vulnerable-example/Cargo.toml +++ b/test-cases/buffering-unsized-types/buffering-unsized-types-1/vulnerable-example/Cargo.toml @@ -1,33 +1,18 @@ [package] -name = "buffering-unsized-types-vulnerable" -version = "0.1.0" -authors = ["[your_name] <[your_email]>"] edition = "2021" +name = "buffering-unsized-types-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - - -[dev-dependencies] -ink_e2e = { workspace = true } -[profile.release] -overflow-checks = false - -[profile.dev] -overflow-checks = false - diff --git a/test-cases/delegate-call/delegate-call-1/divider-example/Cargo.toml b/test-cases/delegate-call/delegate-call-1/divider-example/Cargo.toml index 424fba99..cbde0526 100755 --- a/test-cases/delegate-call/delegate-call-1/divider-example/Cargo.toml +++ b/test-cases/delegate-call/delegate-call-1/divider-example/Cargo.toml @@ -1,21 +1,17 @@ [package] +authors = ["[your_name] <[your_email]>"] +edition = "2021" name = "delegate-call-divider" version = "0.1.0" -edition = "2021" -authors = ["[your_name] <[your_email]>"] [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } @@ -23,4 +19,4 @@ scale = { workspace = true } scale-info = { workspace = true } [dev-dependencies] -ink_e2e = { workspace = true } \ No newline at end of file +ink_e2e = { workspace = true } diff --git a/test-cases/delegate-call/delegate-call-1/remediated-example/Cargo.toml b/test-cases/delegate-call/delegate-call-1/remediated-example/Cargo.toml index 83d09abe..2c159ae6 100755 --- a/test-cases/delegate-call/delegate-call-1/remediated-example/Cargo.toml +++ b/test-cases/delegate-call/delegate-call-1/remediated-example/Cargo.toml @@ -1,21 +1,16 @@ [package] +edition = "2021" name = "delegate-call-remediated-1" version = "0.1.0" -edition = "2021" -authors = ["[your_name] <[your_email]>"] [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } @@ -23,5 +18,4 @@ scale = { workspace = true } scale-info = { workspace = true } [dev-dependencies] -ink_e2e = { workspace = true } delegate-call-divider = { path = "../divider-example" } diff --git a/test-cases/delegate-call/delegate-call-1/remediated-example/src/lib.rs b/test-cases/delegate-call/delegate-call-1/remediated-example/src/lib.rs index 621d0e5d..8b0ddbbc 100755 --- a/test-cases/delegate-call/delegate-call-1/remediated-example/src/lib.rs +++ b/test-cases/delegate-call/delegate-call-1/remediated-example/src/lib.rs @@ -174,98 +174,4 @@ mod delegate_call { assert_eq!(contract.target, [0x02; 32].into()); } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use delegate_call_divider::delegate_call_divider::DelegateCallDividerRef; - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn payout_works(mut client: ink_e2e::Client) -> E2EResult<()> { - // Arrange - let bob_account_id: ink::primitives::AccountId = - ink_e2e::bob::() - .account_id() - .0 - .into(); - let bob_initial_balance = client.balance(bob_account_id).await.unwrap(); - let charlie_account_id: ink::primitives::AccountId = - ink_e2e::charlie::() - .account_id() - .0 - .into(); - let charlie_initial_balance = client.balance(charlie_account_id).await.unwrap(); - let dave_account_id: ink::primitives::AccountId = - ink_e2e::dave::() - .account_id() - .0 - .into(); - let dave_initial_balance = client.balance(dave_account_id).await.unwrap(); - - let divider_constructor = DelegateCallDividerRef::new( - bob_account_id, - charlie_account_id, - dave_account_id, - 10, - 20, - 70, - ); - let divider_contract_acc_id = client - .instantiate( - "delegate-call-divider", - &ink_e2e::alice(), - divider_constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - let divider_contract_codehash_call = - build_message::(divider_contract_acc_id.clone()) - .call(|contract| contract.codehash()); - let divider_contract_codehash = client - .call_dry_run(&ink_e2e::alice(), ÷r_contract_codehash_call, 0, None) - .await - .return_value(); - - let constructor = DelegateCallRef::new( - bob_account_id, - charlie_account_id, - dave_account_id, - 10, - 20, - 70, - divider_contract_codehash, - ); - let contract_acc_id = client - .instantiate("delegate-call", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - // Act - let ask_payouts_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.ask_payouts()); - let ask_payouts = client - .call(&ink_e2e::alice(), ask_payouts_call, 100, None) - .await; - - // Assert - let bob_current_balance = client.balance(bob_account_id).await.unwrap(); - let charlie_current_balance = client.balance(charlie_account_id).await.unwrap(); - let dave_current_balance = client.balance(dave_account_id).await.unwrap(); - - assert!(ask_payouts.is_ok()); - assert_eq!(bob_current_balance - bob_initial_balance, 10); - assert_eq!(charlie_current_balance - charlie_initial_balance, 20); - assert_eq!(dave_current_balance - dave_initial_balance, 70); - - Ok(()) - } - } } diff --git a/test-cases/delegate-call/delegate-call-1/vulnerable-example/Cargo.toml b/test-cases/delegate-call/delegate-call-1/vulnerable-example/Cargo.toml index 3ce7d738..11ec4855 100755 --- a/test-cases/delegate-call/delegate-call-1/vulnerable-example/Cargo.toml +++ b/test-cases/delegate-call/delegate-call-1/vulnerable-example/Cargo.toml @@ -1,21 +1,16 @@ [package] +edition = "2021" name = "delegate-call-vulnerable-1" version = "0.1.0" -edition = "2021" -authors = ["[your_name] <[your_email]>"] [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } @@ -23,5 +18,4 @@ scale = { workspace = true } scale-info = { workspace = true } [dev-dependencies] -ink_e2e = { workspace = true } delegate-call-divider = { path = "../divider-example" } diff --git a/test-cases/delegate-call/delegate-call-1/vulnerable-example/src/lib.rs b/test-cases/delegate-call/delegate-call-1/vulnerable-example/src/lib.rs index ab2e1a21..14a097e8 100755 --- a/test-cases/delegate-call/delegate-call-1/vulnerable-example/src/lib.rs +++ b/test-cases/delegate-call/delegate-call-1/vulnerable-example/src/lib.rs @@ -91,239 +91,4 @@ mod delegate_call { Ok(()) } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use delegate_call_divider::delegate_call_divider::DelegateCallDividerRef; - use delegate_call_exploiter::delegate_call_exploiter::DelegateCallExploiterRef; - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn constructor_works(mut client: ink_e2e::Client) -> E2EResult<()> { - // Arrange - let bob_account_id: ink::primitives::AccountId = - ink_e2e::bob::() - .account_id() - .0 - .into(); - let charlie_account_id: ink::primitives::AccountId = - ink_e2e::charlie::() - .account_id() - .0 - .into(); - let dave_account_id: ink::primitives::AccountId = - ink_e2e::dave::() - .account_id() - .0 - .into(); - - let constructor = DelegateCallRef::new( - bob_account_id, - charlie_account_id, - dave_account_id, - 10, - 20, - 70, - ); - let contract_acc_id = client - .instantiate("delegate-call", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - // Act - let get_addresses_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.get_addresses()); - let addresses = client - .call_dry_run(&ink_e2e::alice(), &get_addresses_call, 0, None) - .await; - - let get_percentages_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.get_percentages()); - let percentages = client - .call_dry_run(&ink_e2e::alice(), &get_percentages_call, 0, None) - .await; - - // Assert - assert_eq!( - addresses.return_value(), - [bob_account_id, charlie_account_id, dave_account_id] - ); - assert_eq!(percentages.return_value(), (10, 20, 70)); - - Ok(()) - } - - #[ink_e2e::test] - async fn payout_works_with_correct_divider( - mut client: ink_e2e::Client, - ) -> E2EResult<()> { - // Arrange - let bob_account_id: ink::primitives::AccountId = - ink_e2e::bob::() - .account_id() - .0 - .into(); - let bob_initial_balance = client.balance(bob_account_id).await.unwrap(); - let charlie_account_id: ink::primitives::AccountId = - ink_e2e::charlie::() - .account_id() - .0 - .into(); - let charlie_initial_balance = client.balance(charlie_account_id).await.unwrap(); - let dave_account_id: ink::primitives::AccountId = - ink_e2e::dave::() - .account_id() - .0 - .into(); - let dave_initial_balance = client.balance(dave_account_id).await.unwrap(); - - let constructor = DelegateCallRef::new( - bob_account_id, - charlie_account_id, - dave_account_id, - 10, - 20, - 70, - ); - let contract_acc_id = client - .instantiate("delegate-call", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - let divider_constructor = DelegateCallDividerRef::new( - bob_account_id, - charlie_account_id, - dave_account_id, - 10, - 20, - 70, - ); - let divider_contract_acc_id = client - .instantiate( - "delegate-call-divider", - &ink_e2e::alice(), - divider_constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - let divider_contract_codehash_call = - build_message::(divider_contract_acc_id.clone()) - .call(|contract| contract.codehash()); - let divider_contract_codehash = client - .call_dry_run(&ink_e2e::alice(), ÷r_contract_codehash_call, 0, None) - .await - .return_value(); - - // Act - let ask_payouts_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.ask_payouts(divider_contract_codehash)); - let ask_payouts = client - .call(&ink_e2e::alice(), ask_payouts_call, 100, None) - .await; - - // Assert - let bob_current_balance = client.balance(bob_account_id).await.unwrap(); - let charlie_current_balance = client.balance(charlie_account_id).await.unwrap(); - let dave_current_balance = client.balance(dave_account_id).await.unwrap(); - - assert!(ask_payouts.is_ok()); - assert_eq!(bob_current_balance - bob_initial_balance, 10); - assert_eq!(charlie_current_balance - charlie_initial_balance, 20); - assert_eq!(dave_current_balance - dave_initial_balance, 70); - - Ok(()) - } - - #[ink_e2e::test] - async fn payout_works_with_exploit(mut client: ink_e2e::Client) -> E2EResult<()> { - // Arrange - let bob_account_id: ink::primitives::AccountId = - ink_e2e::bob::() - .account_id() - .0 - .into(); - let bob_initial_balance = client.balance(bob_account_id).await.unwrap(); - let charlie_account_id: ink::primitives::AccountId = - ink_e2e::charlie::() - .account_id() - .0 - .into(); - let charlie_initial_balance = client.balance(charlie_account_id).await.unwrap(); - let dave_account_id: ink::primitives::AccountId = - ink_e2e::dave::() - .account_id() - .0 - .into(); - let dave_initial_balance = client.balance(dave_account_id).await.unwrap(); - - let constructor = DelegateCallRef::new( - bob_account_id, - charlie_account_id, - dave_account_id, - 10, - 20, - 70, - ); - let contract_acc_id = client - .instantiate("delegate-call", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - let exploiter_constructor = DelegateCallExploiterRef::new( - bob_account_id, - charlie_account_id, - dave_account_id, - 10, - 20, - 70, - ); - let exploiter_contract_acc_id = client - .instantiate( - "delegate-call-exploiter", - &ink_e2e::alice(), - exploiter_constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - let exploiter_contract_call = - build_message::(exploiter_contract_acc_id.clone()) - .call(|contract| contract.codehash()); - let exploiter_contract_codehash = client - .call_dry_run(&ink_e2e::alice(), &exploiter_contract_call, 0, None) - .await - .return_value(); - - // Act - let ask_payouts_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.ask_payouts(exploiter_contract_codehash)); - let ask_payouts = client - .call(&ink_e2e::alice(), ask_payouts_call, 100, None) - .await; - - // Assert - let bob_current_balance = client.balance(bob_account_id).await.unwrap(); - let charlie_current_balance = client.balance(charlie_account_id).await.unwrap(); - let dave_current_balance = client.balance(dave_account_id).await.unwrap(); - - assert!(ask_payouts.is_ok()); - assert_eq!(bob_current_balance - bob_initial_balance, 70); - assert_eq!(charlie_current_balance - charlie_initial_balance, 10); - assert_eq!(dave_current_balance - dave_initial_balance, 20); - - Ok(()) - } - } } diff --git a/test-cases/divide-before-multiply/divide-before-multiply-1/remediated-example/Cargo.toml b/test-cases/divide-before-multiply/divide-before-multiply-1/remediated-example/Cargo.toml index 73b265d1..d1f510bc 100755 --- a/test-cases/divide-before-multiply/divide-before-multiply-1/remediated-example/Cargo.toml +++ b/test-cases/divide-before-multiply/divide-before-multiply-1/remediated-example/Cargo.toml @@ -1,27 +1,18 @@ [package] +edition = "2021" name = "divide-before-multiply-remediated-1" version = "0.1.0" -edition = "2021" -authors = ["[your_name] <[your_email]>"] [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/divide-before-multiply/divide-before-multiply-1/remediated-example/src/lib.rs b/test-cases/divide-before-multiply/divide-before-multiply-1/remediated-example/src/lib.rs index 8ea9a7e2..0fdb3150 100755 --- a/test-cases/divide-before-multiply/divide-before-multiply-1/remediated-example/src/lib.rs +++ b/test-cases/divide-before-multiply/divide-before-multiply-1/remediated-example/src/lib.rs @@ -28,43 +28,4 @@ mod divide_before_multiply { assert_eq!(contract.split_profit(33, 100), 33); } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn split_profit_e2e(mut client: ink_e2e::Client) -> E2EResult<()> { - // Given - let constructor = DivideBeforeMultiplyRef::new(); - - // When - let contract_acc_id = client - .instantiate( - "divide-before-multiply", - &ink_e2e::bob(), - constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - - // Then - let split_profit = build_message::(contract_acc_id.clone()) - .call(|contract| contract.split_profit(33, 100)); - let split_profit_res = client - .call(&ink_e2e::bob(), split_profit, 0, None) - .await - .expect("split_profit failed"); - assert_eq!(split_profit_res.return_value(), 33); - - Ok(()) - } - } } diff --git a/test-cases/divide-before-multiply/divide-before-multiply-1/vulnerable-example/Cargo.toml b/test-cases/divide-before-multiply/divide-before-multiply-1/vulnerable-example/Cargo.toml index 33852bc1..045ef293 100755 --- a/test-cases/divide-before-multiply/divide-before-multiply-1/vulnerable-example/Cargo.toml +++ b/test-cases/divide-before-multiply/divide-before-multiply-1/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] +edition = "2021" name = "divide-before-multiply-vulnerable-1" version = "0.1.0" -edition = "2021" -authors = ["[your_name] <[your_email]>"] [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/divide-before-multiply/divide-before-multiply-1/vulnerable-example/grep b/test-cases/divide-before-multiply/divide-before-multiply-1/vulnerable-example/grep deleted file mode 100644 index e69de29b..00000000 diff --git a/test-cases/divide-before-multiply/divide-before-multiply-1/vulnerable-example/src/lib.rs b/test-cases/divide-before-multiply/divide-before-multiply-1/vulnerable-example/src/lib.rs index bc3eb5d3..14dad80b 100755 --- a/test-cases/divide-before-multiply/divide-before-multiply-1/vulnerable-example/src/lib.rs +++ b/test-cases/divide-before-multiply/divide-before-multiply-1/vulnerable-example/src/lib.rs @@ -42,43 +42,4 @@ mod divide_before_multiply { assert_eq!(contract.split_profit(33, 100), 0); } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn split_profit_e2e(mut client: ink_e2e::Client) -> E2EResult<()> { - // Given - let constructor = DivideBeforeMultiplyRef::new(); - - // When - let contract_acc_id = client - .instantiate( - "divide-before-multiply", - &ink_e2e::bob(), - constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - - // Then - let split_profit = build_message::(contract_acc_id.clone()) - .call(|contract| contract.split_profit(33, 100)); - let split_profit_res = client - .call(&ink_e2e::bob(), split_profit, 0, None) - .await - .expect("split_profit failed"); - assert_eq!(split_profit_res.return_value(), 0); - - Ok(()) - } - } } diff --git a/test-cases/dont-use-instantiate-contract-v1/dont-use-instantiate-contract-v1-1/remediated-example/Cargo.toml b/test-cases/dont-use-instantiate-contract-v1/dont-use-instantiate-contract-v1-1/remediated-example/Cargo.toml index 25406d96..92b6a404 100644 --- a/test-cases/dont-use-instantiate-contract-v1/dont-use-instantiate-contract-v1-1/remediated-example/Cargo.toml +++ b/test-cases/dont-use-instantiate-contract-v1/dont-use-instantiate-contract-v1-1/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "dont-use-instantiate-contract-v1-1-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "dont-use-instantiate-contract-v1-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/dont-use-instantiate-contract-v1/dont-use-instantiate-contract-v1-1/vulnerable-example/Cargo.toml b/test-cases/dont-use-instantiate-contract-v1/dont-use-instantiate-contract-v1-1/vulnerable-example/Cargo.toml index e2387473..6291ddde 100644 --- a/test-cases/dont-use-instantiate-contract-v1/dont-use-instantiate-contract-v1-1/vulnerable-example/Cargo.toml +++ b/test-cases/dont-use-instantiate-contract-v1/dont-use-instantiate-contract-v1-1/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "dont-use-instantiate-contract-v1-1-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "dont-use-instantiate-contract-v1-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/dont-use-invoke-contract-v1/dont-use-invoke-contract-v1-1/remediated-example/Cargo.toml b/test-cases/dont-use-invoke-contract-v1/dont-use-invoke-contract-v1-1/remediated-example/Cargo.toml index 12f1eb50..f14431b3 100644 --- a/test-cases/dont-use-invoke-contract-v1/dont-use-invoke-contract-v1-1/remediated-example/Cargo.toml +++ b/test-cases/dont-use-invoke-contract-v1/dont-use-invoke-contract-v1-1/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "dont-use-invoke-contract-v1-1-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "dont-use-invoke-contract-v1-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/dont-use-invoke-contract-v1/dont-use-invoke-contract-v1-1/vulnerable-example/Cargo.toml b/test-cases/dont-use-invoke-contract-v1/dont-use-invoke-contract-v1-1/vulnerable-example/Cargo.toml index 1d96e94c..f1e6d215 100644 --- a/test-cases/dont-use-invoke-contract-v1/dont-use-invoke-contract-v1-1/vulnerable-example/Cargo.toml +++ b/test-cases/dont-use-invoke-contract-v1/dont-use-invoke-contract-v1-1/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "dont-use-invoke-contract-v1-1-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "dont-use-invoke-contract-v1-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/dos-unbounded-operation/dos-unbounded-operation-1/remediated-example/Cargo.toml b/test-cases/dos-unbounded-operation/dos-unbounded-operation-1/remediated-example/Cargo.toml index a963dbd1..cfcab2c4 100644 --- a/test-cases/dos-unbounded-operation/dos-unbounded-operation-1/remediated-example/Cargo.toml +++ b/test-cases/dos-unbounded-operation/dos-unbounded-operation-1/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "dos-unbounded-operation-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "dos-unbounded-operation-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/dos-unbounded-operation/dos-unbounded-operation-1/vulnerable-example/Cargo.toml b/test-cases/dos-unbounded-operation/dos-unbounded-operation-1/vulnerable-example/Cargo.toml index 4d21ed02..b60fe087 100644 --- a/test-cases/dos-unbounded-operation/dos-unbounded-operation-1/vulnerable-example/Cargo.toml +++ b/test-cases/dos-unbounded-operation/dos-unbounded-operation-1/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "dos-unbounded-operation-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "dos-unbounded-operation-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/dos-unbounded-operation/dos-unbounded-operation-1/vulnerable-example/src/lib.rs b/test-cases/dos-unbounded-operation/dos-unbounded-operation-1/vulnerable-example/src/lib.rs index dc96b41a..d91bf81b 100644 --- a/test-cases/dos-unbounded-operation/dos-unbounded-operation-1/vulnerable-example/src/lib.rs +++ b/test-cases/dos-unbounded-operation/dos-unbounded-operation-1/vulnerable-example/src/lib.rs @@ -140,92 +140,4 @@ mod dos_unbounded_operation { assert_eq!(payee.value, 0); } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn saves_payee_in_mapping(mut client: ink_e2e::Client) -> E2EResult<()> { - // Arrange - let constructor = DosUnboundedOperationRef::new(); - let contract_acc_id = client - .instantiate( - "dos-unbounded-operation", - &ink_e2e::alice(), - constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - - // Act - let add_payee = build_message::(contract_acc_id.clone()) - .call(|contract| contract.add_payee()); - client - .call(&ink_e2e::alice(), add_payee, 1000, None) - .await - .expect("add_payee failed"); - - // Assert - let get_payee = build_message::(contract_acc_id.clone()) - .call(|contract| contract.get_payee(0)); - let get_payee_res = client - .call(&ink_e2e::alice(), get_payee, 0, None) - .await - .expect("get_payee failed"); - - let payee = get_payee_res.return_value().expect("payee not found"); - let alice_account_id: ink::primitives::AccountId = - ink_e2e::alice::() - .account_id() - .0 - .into(); - assert_eq!(payee.address, alice_account_id); - assert_eq!(payee.value, 1000); - - Ok(()) - } - - #[ink_e2e::test] - async fn pay_out_runs_out_of_gas(mut client: ink_e2e::Client) { - // Arrange - let constructor = DosUnboundedOperationRef::new(); - let contract_acc_id = client - .instantiate( - "dos-unbounded-operation", - &ink_e2e::alice(), - constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - - for _ in 0..10 { - let add_n_payees = - build_message::(contract_acc_id.clone()) - .call(|contract| contract.add_n_payees(1000)); - client - .call(&ink_e2e::alice(), add_n_payees.clone(), 1000, None) - .await - .expect("add_n_payees failed"); - } - - // Act - let pay_out = build_message::(contract_acc_id.clone()) - .call(|contract| contract.pay_out()); - let pay_out_result = client.call(&ink_e2e::alice(), pay_out, 0, None).await; - - // Assert - assert!(pay_out_result.is_err()); - } - } } diff --git a/test-cases/dos-unbounded-operation/dos-unbounded-operation-2/remediated-example/Cargo.toml b/test-cases/dos-unbounded-operation/dos-unbounded-operation-2/remediated-example/Cargo.toml index 8190d84f..3fd7608d 100644 --- a/test-cases/dos-unbounded-operation/dos-unbounded-operation-2/remediated-example/Cargo.toml +++ b/test-cases/dos-unbounded-operation/dos-unbounded-operation-2/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] +edition = "2021" name = "dos-unbounded-operation-remediated-2" version = "0.1.0" -edition = "2021" -authors = ["[your_name] <[your_email]>"] [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/dos-unbounded-operation/dos-unbounded-operation-2/vulnerable-example/Cargo.toml b/test-cases/dos-unbounded-operation/dos-unbounded-operation-2/vulnerable-example/Cargo.toml index 1a8d703c..a89092cb 100644 --- a/test-cases/dos-unbounded-operation/dos-unbounded-operation-2/vulnerable-example/Cargo.toml +++ b/test-cases/dos-unbounded-operation/dos-unbounded-operation-2/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "dos-unbounded-operation-2-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "dos-unbounded-operation-vulnerable-2" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/dos-unbounded-operation/dos-unbounded-operation-2/vulnerable-example/src/lib.rs b/test-cases/dos-unbounded-operation/dos-unbounded-operation-2/vulnerable-example/src/lib.rs index 7c7a8259..06fbc5f6 100644 --- a/test-cases/dos-unbounded-operation/dos-unbounded-operation-2/vulnerable-example/src/lib.rs +++ b/test-cases/dos-unbounded-operation/dos-unbounded-operation-2/vulnerable-example/src/lib.rs @@ -164,92 +164,4 @@ mod dos_unbounded_operation_2 { assert_eq!(payee.value, 0); } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn saves_payee_in_mapping(mut client: ink_e2e::Client) -> E2EResult<()> { - // Arrange - let constructor = DosUnboundedOperationRef::new(); - let contract_acc_id = client - .instantiate( - "dos-unbounded-operation", - &ink_e2e::alice(), - constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - - // Act - let add_payee = build_message::(contract_acc_id.clone()) - .call(|contract| contract.add_payee()); - client - .call(&ink_e2e::alice(), add_payee, 1000, None) - .await - .expect("add_payee failed"); - - // Assert - let get_payee = build_message::(contract_acc_id.clone()) - .call(|contract| contract.get_payee(0)); - let get_payee_res = client - .call(&ink_e2e::alice(), get_payee, 0, None) - .await - .expect("get_payee failed"); - - let payee = get_payee_res.return_value().expect("payee not found"); - let alice_account_id: ink::primitives::AccountId = - ink_e2e::alice::() - .account_id() - .0 - .into(); - assert_eq!(payee.address, alice_account_id); - assert_eq!(payee.value, 1000); - - Ok(()) - } - - #[ink_e2e::test] - async fn pay_out_runs_out_of_gas(mut client: ink_e2e::Client) { - // Arrange - let constructor = DosUnboundedOperationRef::new(); - let contract_acc_id = client - .instantiate( - "dos-unbounded-operation", - &ink_e2e::alice(), - constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - - for _ in 0..10 { - let add_n_payees = - build_message::(contract_acc_id.clone()) - .call(|contract| contract.add_n_payees(1000)); - client - .call(&ink_e2e::alice(), add_n_payees.clone(), 1000, None) - .await - .expect("add_n_payees failed"); - } - - // Act - let pay_out = build_message::(contract_acc_id.clone()) - .call(|contract| contract.pay_out()); - let pay_out_result = client.call(&ink_e2e::alice(), pay_out, 0, None).await; - - // Assert - assert!(pay_out_result.is_err()); - } - } } diff --git a/test-cases/dos-unexpected-revert-with-vector/dos-unexpected-revert-with-vector-1/remediated-example/Cargo.toml b/test-cases/dos-unexpected-revert-with-vector/dos-unexpected-revert-with-vector-1/remediated-example/Cargo.toml index 37c04006..fc8422b9 100644 --- a/test-cases/dos-unexpected-revert-with-vector/dos-unexpected-revert-with-vector-1/remediated-example/Cargo.toml +++ b/test-cases/dos-unexpected-revert-with-vector/dos-unexpected-revert-with-vector-1/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "unexpected-revert-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "dos-unexpected-revert-with-vector-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/dos-unexpected-revert-with-vector/dos-unexpected-revert-with-vector-1/remediated-example/src/lib.rs b/test-cases/dos-unexpected-revert-with-vector/dos-unexpected-revert-with-vector-1/remediated-example/src/lib.rs index 8cf2d313..0f91b855 100644 --- a/test-cases/dos-unexpected-revert-with-vector/dos-unexpected-revert-with-vector-1/remediated-example/src/lib.rs +++ b/test-cases/dos-unexpected-revert-with-vector/dos-unexpected-revert-with-vector-1/remediated-example/src/lib.rs @@ -192,46 +192,4 @@ mod unexpected_revert { assert!(candidate.is_ok()); } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - #[ink_e2e::test] - async fn insert_512_candidates(mut client: ink_e2e::Client) { - let now: u64 = match SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) { - Ok(n) => (n.as_secs() + 10 * 60) * 1000, - Err(_) => panic!("SystemTime before UNIX EPOCH!"), - }; - let constructor = UnexpectedRevertRef::new(now); - let contract_acc_id = client - .instantiate("unexpected-revert", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - for i in 0u32..512 { - let mut zero_vec = vec![0u8; 28]; - zero_vec.extend(i.to_be_bytes().iter().cloned()); - let arr: [u8; 32] = match zero_vec.as_slice().try_into() { - Ok(arr) => arr, - Err(_) => panic!(), - }; - let addr = AccountId::from(arr); - - let add_candidate = build_message::(contract_acc_id.clone()) - .call(|contract| contract.add_candidate(addr)); - client - .call(&ink_e2e::bob(), add_candidate.clone(), 0, None) - .await - .expect("add_candidate failed"); - } - let get_total_candidates = - build_message::(contract_acc_id.clone()) - .call(|contract| contract.get_total_candidates()); - let candidates_count = client - .call(&ink_e2e::bob(), get_total_candidates.clone(), 0, None) - .await - .expect("candidates_count failed"); - assert_eq!(candidates_count.return_value(), 512); - } - } } diff --git a/test-cases/dos-unexpected-revert-with-vector/dos-unexpected-revert-with-vector-1/vulnerable-example/Cargo.toml b/test-cases/dos-unexpected-revert-with-vector/dos-unexpected-revert-with-vector-1/vulnerable-example/Cargo.toml index b928ed60..93ffe8e7 100644 --- a/test-cases/dos-unexpected-revert-with-vector/dos-unexpected-revert-with-vector-1/vulnerable-example/Cargo.toml +++ b/test-cases/dos-unexpected-revert-with-vector/dos-unexpected-revert-with-vector-1/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "unexpected-revert-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "dos-unexpected-revert-with-vector-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/dos-unexpected-revert-with-vector/dos-unexpected-revert-with-vector-1/vulnerable-example/src/lib.rs b/test-cases/dos-unexpected-revert-with-vector/dos-unexpected-revert-with-vector-1/vulnerable-example/src/lib.rs index 6223f71a..4811df16 100644 --- a/test-cases/dos-unexpected-revert-with-vector/dos-unexpected-revert-with-vector-1/vulnerable-example/src/lib.rs +++ b/test-cases/dos-unexpected-revert-with-vector/dos-unexpected-revert-with-vector-1/vulnerable-example/src/lib.rs @@ -189,39 +189,4 @@ mod unexpected_revert { assert!(candidate.is_ok()); } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - #[ink_e2e::test] - #[should_panic(expected = "add_candidate failed: CallDryRun")] - async fn insert_512_candidates(mut client: ink_e2e::Client) { - let now: u64 = match SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) { - Ok(n) => (n.as_secs() + 10 * 60) * 1000, - Err(_) => panic!("SystemTime before UNIX EPOCH!"), - }; - let constructor = UnexpectedRevertRef::new(now); - let contract_acc_id = client - .instantiate("unexpected-revert", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - for i in 0u32..512 { - let mut zero_vec = vec![0u8; 28]; - zero_vec.extend(i.to_be_bytes().iter().cloned()); - let arr: [u8; 32] = match zero_vec.as_slice().try_into() { - Ok(arr) => arr, - Err(_) => panic!(), - }; - let addr = AccountId::from(arr); - - let add_candidate = build_message::(contract_acc_id.clone()) - .call(|contract| contract.add_candidate(addr)); - client - .call(&ink_e2e::bob(), add_candidate.clone(), 0, None) - .await - .expect("add_candidate failed"); - } - } - } } diff --git a/test-cases/incorrect-exponentiation/incorrect-exponentiation-1/remediated-example/Cargo.toml b/test-cases/incorrect-exponentiation/incorrect-exponentiation-1/remediated-example/Cargo.toml index 241c9494..ac733455 100644 --- a/test-cases/incorrect-exponentiation/incorrect-exponentiation-1/remediated-example/Cargo.toml +++ b/test-cases/incorrect-exponentiation/incorrect-exponentiation-1/remediated-example/Cargo.toml @@ -1,32 +1,18 @@ [package] -name = "incorrect-exponentiation-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "incorrect-exponentiation-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } - -[profile.dev] -overflow-checks = false - -[profile.release] -overflow-checks = false diff --git a/test-cases/incorrect-exponentiation/incorrect-exponentiation-1/vulnerable-example/Cargo.toml b/test-cases/incorrect-exponentiation/incorrect-exponentiation-1/vulnerable-example/Cargo.toml index 7cd6813d..804dfa08 100644 --- a/test-cases/incorrect-exponentiation/incorrect-exponentiation-1/vulnerable-example/Cargo.toml +++ b/test-cases/incorrect-exponentiation/incorrect-exponentiation-1/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "incorrect-exponentiation-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "incorrect-exponentiation-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/ink-version/ink-version-1/remediated-example/Cargo.toml b/test-cases/ink-version/ink-version-1/remediated-example/Cargo.toml index 6cf717a6..424a1987 100755 --- a/test-cases/ink-version/ink-version-1/remediated-example/Cargo.toml +++ b/test-cases/ink-version/ink-version-1/remediated-example/Cargo.toml @@ -1,28 +1,18 @@ [package] -name = "ink_version-remediated" -version = "0.1.0" -authors = ["[your_name] <[your_email]>"] edition = "2021" - - -[dependencies] -ink = { workspace = true } -scale = { workspace = true } -scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } +name = "ink-version-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] +[dependencies] +ink = { workspace = true } +scale = { workspace = true } +scale-info = { workspace = true } diff --git a/test-cases/ink-version/ink-version-1/vulnerable-example/Cargo.toml b/test-cases/ink-version/ink-version-1/vulnerable-example/Cargo.toml index 8bed0c11..46cdcd38 100755 --- a/test-cases/ink-version/ink-version-1/vulnerable-example/Cargo.toml +++ b/test-cases/ink-version/ink-version-1/vulnerable-example/Cargo.toml @@ -1,30 +1,18 @@ [package] -name = "ink_version-vulnerable" -version = "0.1.0" -authors = ["[your_name] <[your_email]>"] edition = "2021" - - -[dependencies] -ink = { version = "4.0.0", default-features = false } -scale = { workspace = true } -scale-info = { workspace = true } - -# Needed for compilation - -[dev-dependencies] -ink_e2e = { workspace = true } +name = "ink-version-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] +[dependencies] +ink = { version = "4.0.0", default-features = false } +scale = { workspace = true } +scale-info = { workspace = true } diff --git a/test-cases/insufficiently-random-values/insufficiently-random-values-1/remediated-example/Cargo.toml b/test-cases/insufficiently-random-values/insufficiently-random-values-1/remediated-example/Cargo.toml index 1c796747..d7b846e4 100755 --- a/test-cases/insufficiently-random-values/insufficiently-random-values-1/remediated-example/Cargo.toml +++ b/test-cases/insufficiently-random-values/insufficiently-random-values-1/remediated-example/Cargo.toml @@ -1,8 +1,18 @@ [package] -name = "insufficiently-random-values-remediated" -version = "0.1.0" -authors = ["[your_name] <[your_email]>"] edition = "2021" +name = "insufficiently-random-values-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" + +[features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] +default = ["std"] +std = ["ink/std", "scale-info/std", "scale/std"] + +[dependencies] +ink = { workspace = true } +scale = { workspace = true } +scale-info = { workspace = true } diff --git a/test-cases/insufficiently-random-values/insufficiently-random-values-1/vulnerable-example/Cargo.toml b/test-cases/insufficiently-random-values/insufficiently-random-values-1/vulnerable-example/Cargo.toml index 0729b427..43b58fc2 100755 --- a/test-cases/insufficiently-random-values/insufficiently-random-values-1/vulnerable-example/Cargo.toml +++ b/test-cases/insufficiently-random-values/insufficiently-random-values-1/vulnerable-example/Cargo.toml @@ -1,28 +1,18 @@ [package] -name = "insufficiently-random-values-vulnerable" -version = "0.1.0" -authors = ["[your_name] <[your_email]>"] edition = "2021" +name = "insufficiently-random-values-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] - +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/integer-overflow-or-underflow/integer-overflow-or-underflow-1/remediated-example/Cargo.toml b/test-cases/integer-overflow-or-underflow/integer-overflow-or-underflow-1/remediated-example/Cargo.toml index 8381b079..dd7ab6f9 100644 --- a/test-cases/integer-overflow-or-underflow/integer-overflow-or-underflow-1/remediated-example/Cargo.toml +++ b/test-cases/integer-overflow-or-underflow/integer-overflow-or-underflow-1/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "integer-overflow-or-underflow-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "integer-overflow-or-underflow-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/integer-overflow-or-underflow/integer-overflow-or-underflow-1/vulnerable-example/Cargo.toml b/test-cases/integer-overflow-or-underflow/integer-overflow-or-underflow-1/vulnerable-example/Cargo.toml index 696142c5..f84c0c45 100644 --- a/test-cases/integer-overflow-or-underflow/integer-overflow-or-underflow-1/vulnerable-example/Cargo.toml +++ b/test-cases/integer-overflow-or-underflow/integer-overflow-or-underflow-1/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "integer-overflow-or-underflow-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "integer-overflow-or-underflow-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/integer-overflow-or-underflow/integer-overflow-or-underflow-2/remediated-example/Cargo.toml b/test-cases/integer-overflow-or-underflow/integer-overflow-or-underflow-2/remediated-example/Cargo.toml index b9127a26..1b50bf79 100644 --- a/test-cases/integer-overflow-or-underflow/integer-overflow-or-underflow-2/remediated-example/Cargo.toml +++ b/test-cases/integer-overflow-or-underflow/integer-overflow-or-underflow-2/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] +edition = "2021" name = "integer-overflow-or-underflow-remediated-2" version = "0.1.0" -edition = "2021" -authors = ["[your_name] <[your_email]>"] [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/integer-overflow-or-underflow/integer-overflow-or-underflow-2/vulnerable-example/Cargo.toml b/test-cases/integer-overflow-or-underflow/integer-overflow-or-underflow-2/vulnerable-example/Cargo.toml index 363a00a8..dee3e161 100644 --- a/test-cases/integer-overflow-or-underflow/integer-overflow-or-underflow-2/vulnerable-example/Cargo.toml +++ b/test-cases/integer-overflow-or-underflow/integer-overflow-or-underflow-2/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] +edition = "2021" name = "integer-overflow-or-underflow-vulnerable-2" version = "0.1.0" -edition = "2021" -authors = ["[your_name] <[your_email]>"] [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/iterators-over-indexing/iterators-over-indexing-1/remediated-example/Cargo.toml b/test-cases/iterators-over-indexing/iterators-over-indexing-1/remediated-example/Cargo.toml index 5d375ec0..146a5bc3 100755 --- a/test-cases/iterators-over-indexing/iterators-over-indexing-1/remediated-example/Cargo.toml +++ b/test-cases/iterators-over-indexing/iterators-over-indexing-1/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "iterators_over_indexing-remediated" -version = "0.1.0" -authors = ["[your_name] <[your_email]>"] edition = "2021" +name = "iterators-over-indexing-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/iterators-over-indexing/iterators-over-indexing-1/vulnerable-example/Cargo.toml b/test-cases/iterators-over-indexing/iterators-over-indexing-1/vulnerable-example/Cargo.toml index 2d5362f7..05ba863f 100755 --- a/test-cases/iterators-over-indexing/iterators-over-indexing-1/vulnerable-example/Cargo.toml +++ b/test-cases/iterators-over-indexing/iterators-over-indexing-1/vulnerable-example/Cargo.toml @@ -1,26 +1,19 @@ [package] -name = "iterators_over_indexing-vulnerable" -version = "0.1.0" -authors = ["[your_name] <[your_email]>"] edition = "2021" +name = "iterators-over-indexing-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/lazy-delegate/lazy-delegate-1/exploiter-example/Cargo.toml b/test-cases/lazy-delegate/lazy-delegate-1/exploiter-example/Cargo.toml index c0530710..41fa9ab6 100755 --- a/test-cases/lazy-delegate/lazy-delegate-1/exploiter-example/Cargo.toml +++ b/test-cases/lazy-delegate/lazy-delegate-1/exploiter-example/Cargo.toml @@ -1,26 +1,18 @@ [package] +edition = "2021" name = "delegate-call-exploiter" version = "0.1.0" -edition = "2021" -authors = ["[your_name] <[your_email]>"] [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/lazy-delegate/lazy-delegate-1/fixed-exploiter-example/Cargo.toml b/test-cases/lazy-delegate/lazy-delegate-1/fixed-exploiter-example/Cargo.toml index f5365d52..368139dc 100755 --- a/test-cases/lazy-delegate/lazy-delegate-1/fixed-exploiter-example/Cargo.toml +++ b/test-cases/lazy-delegate/lazy-delegate-1/fixed-exploiter-example/Cargo.toml @@ -1,26 +1,18 @@ [package] +edition = "2021" name = "delegate-call-fixed-exploiter" version = "0.1.0" -edition = "2021" -authors = ["[your_name] <[your_email]>"] [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/lazy-delegate/lazy-delegate-1/remediated-example/Cargo.toml b/test-cases/lazy-delegate/lazy-delegate-1/remediated-example/Cargo.toml index d39e716a..acfa4509 100755 --- a/test-cases/lazy-delegate/lazy-delegate-1/remediated-example/Cargo.toml +++ b/test-cases/lazy-delegate/lazy-delegate-1/remediated-example/Cargo.toml @@ -1,21 +1,16 @@ [package] -name = "delegate-call-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "lazy-delegate-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } @@ -23,5 +18,4 @@ scale = { workspace = true } scale-info = { workspace = true } [dev-dependencies] -ink_e2e = { workspace = true } delegate-call-fixed-exploiter = { path = "../fixed-exploiter-example" } diff --git a/test-cases/lazy-delegate/lazy-delegate-1/remediated-example/src/lib.rs b/test-cases/lazy-delegate/lazy-delegate-1/remediated-example/src/lib.rs index 64a854ff..d349045c 100755 --- a/test-cases/lazy-delegate/lazy-delegate-1/remediated-example/src/lib.rs +++ b/test-cases/lazy-delegate/lazy-delegate-1/remediated-example/src/lib.rs @@ -64,81 +64,4 @@ mod delegate_call { Ok(res) } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use delegate_call_exploiter::delegate_call_exploiter::DelegateCallExploiterRef; - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn delegate_change_of_admin(mut client: ink_e2e::Client) -> E2EResult<()> { - // Arrange - let bob_account_id: ink::primitives::AccountId = - ink_e2e::bob::() - .account_id() - .0 - .into(); - - let constructor = DelegateCallRef::new(); - - let contract_acc_id = client - .instantiate("delegate-call", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - //call get_admin - let previous_admin = build_message::(contract_acc_id.clone()) - .call(|contract| contract.get_admin()) - .account_id() - .clone(); - - // Act - let exploit_contract = DelegateCallExploiterRef::new(); - - let exploit_contract_acc_id = client - .instantiate( - "delegate-call-exploiter", - &ink_e2e::alice(), - exploit_contract, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - - let exploiter_contract_call = - build_message::(exploit_contract_acc_id.clone()) - .call(|contract| contract.codehash()); - - let exploiter_contract_codehash = client - .call_dry_run(&ink_e2e::alice(), &exploiter_contract_call, 0, None) - .await - .return_value(); - - let change_admin_call = - build_message::(contract_acc_id.clone()).call(|contract| { - contract.change_admin(exploiter_contract_codehash, bob_account_id) - }); - - let change_admin = client - .call(&ink_e2e::alice(), change_admin_call, 0, None) - .await; - - let new_admin = build_message::(contract_acc_id.clone()) - .call(|contract| contract.get_admin()) - .account_id() - .clone(); - - // Assert - assert!(change_admin.is_ok()); - assert_ne!(previous_admin, new_admin); - Ok(()) - } - } } diff --git a/test-cases/lazy-delegate/lazy-delegate-1/vulnerable-example/Cargo.toml b/test-cases/lazy-delegate/lazy-delegate-1/vulnerable-example/Cargo.toml index 2176775d..4530077d 100755 --- a/test-cases/lazy-delegate/lazy-delegate-1/vulnerable-example/Cargo.toml +++ b/test-cases/lazy-delegate/lazy-delegate-1/vulnerable-example/Cargo.toml @@ -1,21 +1,16 @@ [package] -name = "delegate-call-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "lazy-delegate-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } @@ -23,5 +18,4 @@ scale = { workspace = true } scale-info = { workspace = true } [dev-dependencies] -ink_e2e = { workspace = true } delegate-call-exploiter = { path = "../exploiter-example" } diff --git a/test-cases/lazy-delegate/lazy-delegate-1/vulnerable-example/src/lib.rs b/test-cases/lazy-delegate/lazy-delegate-1/vulnerable-example/src/lib.rs index e0a5e200..d8072ce0 100755 --- a/test-cases/lazy-delegate/lazy-delegate-1/vulnerable-example/src/lib.rs +++ b/test-cases/lazy-delegate/lazy-delegate-1/vulnerable-example/src/lib.rs @@ -59,81 +59,4 @@ mod delegate_call { Ok(res) } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use delegate_call_exploiter::delegate_call_exploiter::DelegateCallExploiterRef; - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn delegate_change_of_admin(mut client: ink_e2e::Client) -> E2EResult<()> { - // Arrange - let bob_account_id: ink::primitives::AccountId = - ink_e2e::bob::() - .account_id() - .0 - .into(); - - let constructor = DelegateCallRef::new(); - - let contract_acc_id = client - .instantiate("delegate-call", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - //call get_admin - let previous_admin = build_message::(contract_acc_id.clone()) - .call(|contract| contract.get_admin()) - .account_id() - .clone(); - - // Act - let exploit_contract = DelegateCallExploiterRef::new(); - - let exploit_contract_acc_id = client - .instantiate( - "delegate-call-exploiter", - &ink_e2e::alice(), - exploit_contract, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - - let exploiter_contract_call = - build_message::(exploit_contract_acc_id.clone()) - .call(|contract| contract.codehash()); - - let exploiter_contract_codehash = client - .call_dry_run(&ink_e2e::alice(), &exploiter_contract_call, 0, None) - .await - .return_value(); - - let change_admin_call = - build_message::(contract_acc_id.clone()).call(|contract| { - contract.change_admin(exploiter_contract_codehash, bob_account_id) - }); - - let change_admin = client - .call(&ink_e2e::alice(), change_admin_call, 0, None) - .await; - - let new_admin = build_message::(contract_acc_id.clone()) - .call(|contract| contract.get_admin()) - .account_id() - .clone(); - - // Assert - assert!(change_admin.is_ok()); - assert_eq!(previous_admin, new_admin); - Ok(()) - } - } } diff --git a/test-cases/lazy-values-not-set/lazy-values-not-set-1/remediated-example/Cargo.toml b/test-cases/lazy-values-not-set/lazy-values-not-set-1/remediated-example/Cargo.toml index a31d0174..6b12940a 100755 --- a/test-cases/lazy-values-not-set/lazy-values-not-set-1/remediated-example/Cargo.toml +++ b/test-cases/lazy-values-not-set/lazy-values-not-set-1/remediated-example/Cargo.toml @@ -1,28 +1,19 @@ [package] -name = "lazy-values-not-set-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "lazy-values-not-set-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } -[dev-dependencies] -ink_e2e = { workspace = true } - - diff --git a/test-cases/lazy-values-not-set/lazy-values-not-set-1/vulnerable-example/Cargo.toml b/test-cases/lazy-values-not-set/lazy-values-not-set-1/vulnerable-example/Cargo.toml index be7f770c..8710ecf6 100755 --- a/test-cases/lazy-values-not-set/lazy-values-not-set-1/vulnerable-example/Cargo.toml +++ b/test-cases/lazy-values-not-set/lazy-values-not-set-1/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "lazy-values-not-set-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "lazy-values-not-set-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/non-payable-transferred-value/non-payable-transferred-value-1/remediated-example/Cargo.toml b/test-cases/non-payable-transferred-value/non-payable-transferred-value-1/remediated-example/Cargo.toml index 3d4023c8..d5ed78ba 100644 --- a/test-cases/non-payable-transferred-value/non-payable-transferred-value-1/remediated-example/Cargo.toml +++ b/test-cases/non-payable-transferred-value/non-payable-transferred-value-1/remediated-example/Cargo.toml @@ -1,31 +1,18 @@ [package] -name = "non-payable-transferred-value-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "non-payable-transferred-value-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } -[profile.dev] -overflow-checks = false - -[profile.release] -overflow-checks = false diff --git a/test-cases/non-payable-transferred-value/non-payable-transferred-value-1/vulnerable-example/Cargo.toml b/test-cases/non-payable-transferred-value/non-payable-transferred-value-1/vulnerable-example/Cargo.toml index 441a42e6..fe7e0306 100644 --- a/test-cases/non-payable-transferred-value/non-payable-transferred-value-1/vulnerable-example/Cargo.toml +++ b/test-cases/non-payable-transferred-value/non-payable-transferred-value-1/vulnerable-example/Cargo.toml @@ -1,31 +1,18 @@ [package] -name = "non-payable-transferred-value-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "non-payable-transferred-value-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } -[profile.dev] -overflow-checks = false - -[profile.release] -overflow-checks = false diff --git a/test-cases/panic-error/panic-error-1/remediated-example/Cargo.toml b/test-cases/panic-error/panic-error-1/remediated-example/Cargo.toml index cd217c8a..5a31b888 100644 --- a/test-cases/panic-error/panic-error-1/remediated-example/Cargo.toml +++ b/test-cases/panic-error/panic-error-1/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "panic-error-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "panic-error-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/panic-error/panic-error-1/remediated-example/src/lib.rs b/test-cases/panic-error/panic-error-1/remediated-example/src/lib.rs index ecba1127..d84f883c 100644 --- a/test-cases/panic-error/panic-error-1/remediated-example/src/lib.rs +++ b/test-cases/panic-error/panic-error-1/remediated-example/src/lib.rs @@ -62,34 +62,4 @@ mod panic_error { assert_eq!(result, Err(Error::OverflowError)); } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn add_returns_error(mut client: ink_e2e::Client) -> E2EResult<()> { - // Arrange - let constructor = PanicErrorRef::new(u32::MAX); - let contract_acc_id = client - .instantiate("panic-error", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - // Act - let add = build_message::(contract_acc_id.clone()) - .call(|contract| contract.add(1)); - let result = client.call(&ink_e2e::alice(), add, 0, None).await; - - // Assert - assert!(result.is_err()); - - Ok(()) - } - } } diff --git a/test-cases/panic-error/panic-error-1/vulnerable-example/Cargo.toml b/test-cases/panic-error/panic-error-1/vulnerable-example/Cargo.toml index c65574de..d13cf045 100644 --- a/test-cases/panic-error/panic-error-1/vulnerable-example/Cargo.toml +++ b/test-cases/panic-error/panic-error-1/vulnerable-example/Cargo.toml @@ -1,26 +1,19 @@ [package] -name = "panic-error-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "panic-error-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/panic-error/panic-error-1/vulnerable-example/src/lib.rs b/test-cases/panic-error/panic-error-1/vulnerable-example/src/lib.rs index deb5c615..bfb948e8 100644 --- a/test-cases/panic-error/panic-error-1/vulnerable-example/src/lib.rs +++ b/test-cases/panic-error/panic-error-1/vulnerable-example/src/lib.rs @@ -54,34 +54,4 @@ mod panic_error { // Assert - handled by the `should_panic` attribute } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn add_panics(mut client: ink_e2e::Client) -> E2EResult<()> { - // Arrange - let constructor = PanicErrorRef::new(u32::MAX); - let contract_acc_id = client - .instantiate("panic-error", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - // Act - let add = build_message::(contract_acc_id.clone()) - .call(|contract| contract.add(1)); - let result = client.call(&ink_e2e::alice(), add, 0, None).await; - - // Assert - assert!(result.is_err()); - - Ok(()) - } - } } diff --git a/test-cases/reentrancy-1/reentrancy-1-1/remediated-example/Cargo.toml b/test-cases/reentrancy-1/reentrancy-1-1/remediated-example/Cargo.toml index 23a0bb38..8e60831a 100644 --- a/test-cases/reentrancy-1/reentrancy-1-1/remediated-example/Cargo.toml +++ b/test-cases/reentrancy-1/reentrancy-1-1/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "reentrancy-1-1-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "reentrancy-1-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/reentrancy-1/reentrancy-1-1/vulnerable-example/Cargo.toml b/test-cases/reentrancy-1/reentrancy-1-1/vulnerable-example/Cargo.toml index a56d505a..afb51ef7 100644 --- a/test-cases/reentrancy-1/reentrancy-1-1/vulnerable-example/Cargo.toml +++ b/test-cases/reentrancy-1/reentrancy-1-1/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "reentrancy-1-1-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "reentrancy-1-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/reentrancy-1/reentrancy-1-2/remediated-example/Cargo.toml b/test-cases/reentrancy-1/reentrancy-1-2/remediated-example/Cargo.toml index 294da673..4af84ff5 100644 --- a/test-cases/reentrancy-1/reentrancy-1-2/remediated-example/Cargo.toml +++ b/test-cases/reentrancy-1/reentrancy-1-2/remediated-example/Cargo.toml @@ -1,22 +1,16 @@ [package] -name = "reentrancy-1-2-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "reentrancy-1-remediated-2" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std"] [dependencies] -ink = { version = "5.0.0", default-features = false } - -[dev-dependencies] -ink_e2e = { version = "5.0.0" } +ink = { workspace = true } diff --git a/test-cases/reentrancy-1/reentrancy-1-2/vulnerable-example/Cargo.toml b/test-cases/reentrancy-1/reentrancy-1-2/vulnerable-example/Cargo.toml index ddea2bed..a4a4f065 100644 --- a/test-cases/reentrancy-1/reentrancy-1-2/vulnerable-example/Cargo.toml +++ b/test-cases/reentrancy-1/reentrancy-1-2/vulnerable-example/Cargo.toml @@ -1,22 +1,16 @@ [package] -name = "reentrancy-1-2-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "reentrancy-1-vulnerable-2" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std"] [dependencies] -ink = { version = "5.0.0", default-features = false } - -[dev-dependencies] -ink_e2e = { version = "5.0.0" } +ink = { workspace = true } diff --git a/test-cases/reentrancy-2/reentrancy-2-1/remediated-example/Cargo.toml b/test-cases/reentrancy-2/reentrancy-2-1/remediated-example/Cargo.toml index f97d2abc..3fafa986 100644 --- a/test-cases/reentrancy-2/reentrancy-2-1/remediated-example/Cargo.toml +++ b/test-cases/reentrancy-2/reentrancy-2-1/remediated-example/Cargo.toml @@ -1,26 +1,19 @@ [package] -name = "reentrancy-2-1-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "reentrancy-2-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/reentrancy-2/reentrancy-2-1/vulnerable-example/Cargo.toml b/test-cases/reentrancy-2/reentrancy-2-1/vulnerable-example/Cargo.toml index b2fcb281..8d10fcb8 100644 --- a/test-cases/reentrancy-2/reentrancy-2-1/vulnerable-example/Cargo.toml +++ b/test-cases/reentrancy-2/reentrancy-2-1/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "reentrancy-2-1-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "reentrancy-2-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/set-code-hash/set-code-hash-1/remediated-example/Cargo.toml b/test-cases/set-code-hash/set-code-hash-1/remediated-example/Cargo.toml index 3d254668..8888da7e 100755 --- a/test-cases/set-code-hash/set-code-hash-1/remediated-example/Cargo.toml +++ b/test-cases/set-code-hash/set-code-hash-1/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "assert_violation-remediated" -version = "0.1.0" -authors = ["[your_name] <[your_email]>"] edition = "2021" +name = "set-code-hash-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/set-code-hash/set-code-hash-1/vulnerable-example/Cargo.toml b/test-cases/set-code-hash/set-code-hash-1/vulnerable-example/Cargo.toml index 7af8af5f..2eb9378e 100755 --- a/test-cases/set-code-hash/set-code-hash-1/vulnerable-example/Cargo.toml +++ b/test-cases/set-code-hash/set-code-hash-1/vulnerable-example/Cargo.toml @@ -1,26 +1,19 @@ [package] -name = "set_code_hash-vulnerable" -version = "0.1.0" -authors = ["[your_name] <[your_email]>"] edition = "2021" +name = "set-code-hash-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/set-contract-storage/set-contract-storage-1/remediated-example/Cargo.toml b/test-cases/set-contract-storage/set-contract-storage-1/remediated-example/Cargo.toml index b43cd317..8c5e376d 100644 --- a/test-cases/set-contract-storage/set-contract-storage-1/remediated-example/Cargo.toml +++ b/test-cases/set-contract-storage/set-contract-storage-1/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "set-contract-storage-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "set-contract-storage-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/set-contract-storage/set-contract-storage-1/remediated-example/src/lib.rs b/test-cases/set-contract-storage/set-contract-storage-1/remediated-example/src/lib.rs index 60c4eda1..ce26571a 100644 --- a/test-cases/set-contract-storage/set-contract-storage-1/remediated-example/src/lib.rs +++ b/test-cases/set-contract-storage/set-contract-storage-1/remediated-example/src/lib.rs @@ -300,11 +300,7 @@ mod erc20 { T: ink::scale::Encode, { use ink::{ - env::hash::{ - Blake2x256, - CryptoHash, - HashOutput, - }, + env::hash::{Blake2x256, CryptoHash, HashOutput}, primitives::Clear, }; @@ -314,10 +310,9 @@ mod erc20 { let len_encoded = encoded.len(); if len_encoded <= len_result { result.as_mut()[..len_encoded].copy_from_slice(&encoded); - return result + return result; } - let mut hash_output = - <::Type as Default>::default(); + let mut hash_output = <::Type as Default>::default(); ::hash(&encoded, &mut hash_output); let copy_len = core::cmp::min(hash_output.len(), len_result); result.as_mut()[0..copy_len].copy_from_slice(&hash_output[0..copy_len]); @@ -330,9 +325,8 @@ mod erc20 { expected_to: Option, expected_value: Balance, ) { - let decoded_event = - ::decode(&mut &event.data[..]) - .expect("encountered invalid contract event data buffer"); + let decoded_event = ::decode(&mut &event.data[..]) + .expect("encountered invalid contract event data buffer"); let Transfer { from, to, value } = decoded_event; assert_eq!(from, expected_from, "encountered invalid Transfer.from"); assert_eq!(to, expected_to, "encountered invalid Transfer.to"); @@ -340,8 +334,7 @@ mod erc20 { let mut expected_topics = Vec::new(); expected_topics.push( - ink::blake2x256!("Transfer(Option,Option,Balance)") - .into(), + ink::blake2x256!("Transfer(Option,Option,Balance)").into(), ); if let Some(from) = expected_from { expected_topics.push(encoded_into_hash(from)); diff --git a/test-cases/set-contract-storage/set-contract-storage-1/vulnerable-example/Cargo.toml b/test-cases/set-contract-storage/set-contract-storage-1/vulnerable-example/Cargo.toml index 6453c21d..0e949dd1 100644 --- a/test-cases/set-contract-storage/set-contract-storage-1/vulnerable-example/Cargo.toml +++ b/test-cases/set-contract-storage/set-contract-storage-1/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "set-contract-storage-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "set-contract-storage-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/set-contract-storage/set-contract-storage-1/vulnerable-example/src/lib.rs b/test-cases/set-contract-storage/set-contract-storage-1/vulnerable-example/src/lib.rs index 1b1f10ce..7f08103a 100644 --- a/test-cases/set-contract-storage/set-contract-storage-1/vulnerable-example/src/lib.rs +++ b/test-cases/set-contract-storage/set-contract-storage-1/vulnerable-example/src/lib.rs @@ -321,9 +321,8 @@ pub mod erc20 { expected_to: Option, expected_value: Balance, ) { - let decoded_event = - ::decode(&mut &event.data[..]) - .expect("encountered invalid contract event data buffer"); + let decoded_event = ::decode(&mut &event.data[..]) + .expect("encountered invalid contract event data buffer"); let Transfer { from, to, value } = decoded_event; assert_eq!(from, expected_from, "encountered invalid Transfer.from"); assert_eq!(to, expected_to, "encountered invalid Transfer.to"); diff --git a/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/remediated-example/Cargo.toml b/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/remediated-example/Cargo.toml index c2492431..b0d78b31 100755 --- a/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/remediated-example/Cargo.toml +++ b/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/remediated-example/Cargo.toml @@ -1,27 +1,18 @@ [package] -name = "unprotected-mapping-operation-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "unprotected-mapping-operation-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" +[features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] +default = ["std"] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } - -[features] -default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] diff --git a/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/remediated-example/src/lib.rs b/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/remediated-example/src/lib.rs index 234a92d8..e076f59d 100755 --- a/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/remediated-example/src/lib.rs +++ b/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/remediated-example/src/lib.rs @@ -59,59 +59,4 @@ mod unprotected_mapping_operation { .map_err(|_| Error::TransferError) } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn e2e_test(mut client: ink_e2e::Client) -> E2EResult<()> { - let constructor = UnprotectedMappingOperationRef::new(); - let umop = client - .instantiate( - "unprotected-mapping-operation", - &ink_e2e::alice(), - constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - - let deposit = build_message::(umop.clone()) - .call(|contract| contract.deposit()); - let _alice_deposit = client - .call(&mut ink_e2e::alice(), deposit, 1000, None) - .await - .expect("Alice deposit failed"); - - let withdraw_all = build_message::(umop.clone()) - .call(|contract| contract.withdraw_all()); - let _alice_withdraw_all = client - .call(&mut ink_e2e::alice(), withdraw_all, 0, None) - .await - .expect("Alice withdraw all"); - - let deposit2 = build_message::(umop.clone()) - .call(|contract| contract.deposit()); - let _alice_deposit = client - .call(&mut ink_e2e::alice(), deposit2, 1000, None) - .await - .expect("Alice deposit failed"); - - let withdraw = build_message::(umop.clone()) - .call(|contract| contract.withdraw(500)); - let _alice_withdraw = client - .call(&mut ink_e2e::alice(), withdraw, 0, None) - .await - .expect("Alice withdraw failed"); - - Ok(()) - } - } } diff --git a/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/vulnerable-example/Cargo.toml b/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/vulnerable-example/Cargo.toml index b8b93f8e..8dfc1448 100755 --- a/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/vulnerable-example/Cargo.toml +++ b/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/vulnerable-example/Cargo.toml @@ -1,28 +1,18 @@ [package] -name = "unprotected-mapping-operation-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "unprotected-mapping-operation-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" +[features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] +default = ["std"] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - - -[dev-dependencies] -ink_e2e = { workspace = true } - -[features] -default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] diff --git a/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/vulnerable-example/src/lib.rs b/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/vulnerable-example/src/lib.rs index 418c46f1..a679bd74 100755 --- a/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/vulnerable-example/src/lib.rs +++ b/test-cases/unprotected-mapping-operation/unprotected-mapping-operation-1/vulnerable-example/src/lib.rs @@ -63,127 +63,4 @@ mod unprotected_mapping_operation { .map_err(|_| Error::TransferError) } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn e2e_test(mut client: ink_e2e::Client) -> E2EResult<()> { - let constructor = UnprotectedMappingOperationRef::new(); - let umop = client - .instantiate( - "unprotected-mapping-operation", - &ink_e2e::alice(), - constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - - let bob_account_id: AccountId = ink_e2e::bob::() - .account_id() - .0 - .into(); - let charlie_account_id: AccountId = ink_e2e::charlie::() - .account_id() - .0 - .into(); - - let deposit_on_bob = build_message::(umop.clone()) - .call(|contract| contract.deposit(bob_account_id)); - let _alice_deposit_on_bob = client - .call(&mut ink_e2e::alice(), deposit_on_bob, 1000, None) - .await - .expect("Alice deposit failed"); - - let deposit_charlie = build_message::(umop.clone()) - .call(|contract| contract.deposit(charlie_account_id)); - let _charlie_deposit = client - .call(&mut ink_e2e::charlie(), deposit_charlie, 1000, None) - .await - .expect("Charlie deposit failed"); - - let withdraw = build_message::(umop.clone()) - .call(|contract| contract.withdraw(1000, bob_account_id)); - let _alice_withdraw_on_bob = client - .call(&mut ink_e2e::alice(), withdraw, 0, None) - .await - .expect("Alice withdraw on bob failed"); - - let withdraw_all = build_message::(umop.clone()) - .call(|contract| contract.withdraw_all(bob_account_id)); - let _charlie_withdraw_all = client - .call(&mut ink_e2e::charlie(), withdraw_all, 0, None) - .await - .expect("Charlie withdraw all"); - /*let escrow_constructor = UnrestrictedTransferFromRef::new( - ink_e2e::account_id(ink_e2e::AccountKeyring::Bob), - ink_e2e::account_id(ink_e2e::AccountKeyring::Charlie), - ink_e2e::account_id(ink_e2e::AccountKeyring::Alice), - token_account_id, - 1000, - ); - - let escrow_account_id = client - .instantiate( - "unrestricted_transfer_from", - &mut ink_e2e::alice(), - escrow_constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - - let approve = build_message::(token_account_id.clone()) - .call(|contract| contract.approve(escrow_account_id, 1000)); - let bob_approve = client.call(bob_borrow, approve, 0, None).await; - assert_eq!(bob_approve.is_ok(), true); - - let balance = build_message::(token_account_id.clone()) - .call(|contract| { - contract.balance_of(ink_e2e::account_id(ink_e2e::AccountKeyring::Bob)) - }); - let bob_balance = client.call_dry_run(bob_borrow, &balance, 0, None).await; - assert_eq!(bob_balance.return_value(), 10000); - - let deposit = build_message::(escrow_account_id.clone()) - .call(|contract| { - contract.deposit(ink_e2e::account_id(ink_e2e::AccountKeyring::Bob)) - }); - let bob_deposit = client.call(bob_borrow, deposit, 0, None).await; - assert_eq!(bob_deposit.is_ok(), true); - - let unlock = build_message::(escrow_account_id.clone()) - .call(|contract| contract.unlock()); - let alice_unlock = client.call(&mut ink_e2e::alice(), unlock, 0, None).await; - assert_eq!(alice_unlock.is_ok(), true); - - let release = build_message::(escrow_account_id.clone()) - .call(|contract| contract.release()); - let charlie_release = client.call(&mut ink_e2e::charlie(), release, 0, None).await; - assert_eq!(charlie_release.is_ok(), true); - - let charlie_balance = build_message::( - token_account_id.clone(), - ) - .call(|contract| { - contract.balance_of(ink_e2e::account_id(ink_e2e::AccountKeyring::Charlie)) - }); - let charlie_balance_ret = client - .call_dry_run(&mut ink_e2e::charlie(), &charlie_balance, 0, None) - .await; - assert_eq!(charlie_balance_ret.return_value(), 1000); - */ - Ok(()) - } - } } diff --git a/test-cases/unprotected-self-destruct/unprotected-self-destruct-1/remediated-example/Cargo.toml b/test-cases/unprotected-self-destruct/unprotected-self-destruct-1/remediated-example/Cargo.toml index 3d273b9c..d5fe3f5e 100755 --- a/test-cases/unprotected-self-destruct/unprotected-self-destruct-1/remediated-example/Cargo.toml +++ b/test-cases/unprotected-self-destruct/unprotected-self-destruct-1/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "unprotected-self-destruct-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "unprotected-self-destruct-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/unprotected-self-destruct/unprotected-self-destruct-1/vulnerable-example/Cargo.toml b/test-cases/unprotected-self-destruct/unprotected-self-destruct-1/vulnerable-example/Cargo.toml index 3d2443e7..a36e1b9b 100755 --- a/test-cases/unprotected-self-destruct/unprotected-self-destruct-1/vulnerable-example/Cargo.toml +++ b/test-cases/unprotected-self-destruct/unprotected-self-destruct-1/vulnerable-example/Cargo.toml @@ -1,26 +1,19 @@ [package] -name = "unprotected-self-destruct-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "unprotected-self-destruct-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/unrestricted-transfer-from/unrestricted-transfer-from-1/remediated-example/src/lib.rs b/test-cases/unrestricted-transfer-from/unrestricted-transfer-from-1/remediated-example/src/lib.rs index d876619a..32bf8965 100755 --- a/test-cases/unrestricted-transfer-from/unrestricted-transfer-from-1/remediated-example/src/lib.rs +++ b/test-cases/unrestricted-transfer-from/unrestricted-transfer-from-1/remediated-example/src/lib.rs @@ -191,90 +191,4 @@ mod unrestricted_transfer_from { } } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use ink_e2e::build_message; - use openbrush::contracts::psp22::psp22_external::PSP22; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test(additional_contracts = "./psp22/Cargo.toml")] - async fn e2e_test(mut client: ink_e2e::Client) -> E2EResult<()> { - let token_constructor = psp22::psp22::ContractRef::new(10000); - let bob_borrow = &mut ink_e2e::bob(); - let token_account_id = client - .instantiate( - "psp22_base_contract", - bob_borrow, - token_constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - let escrow_constructor = UnrestrictedTransferFromRef::new( - ink_e2e::account_id(ink_e2e::AccountKeyring::Bob), - ink_e2e::account_id(ink_e2e::AccountKeyring::Charlie), - ink_e2e::account_id(ink_e2e::AccountKeyring::Alice), - token_account_id, - 1000, - ); - - let escrow_account_id = client - .instantiate( - "unrestricted_transfer_from", - &mut ink_e2e::alice(), - escrow_constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - - let approve = build_message::(token_account_id.clone()) - .call(|contract| contract.approve(escrow_account_id, 1000)); - let bob_approve = client.call(bob_borrow, approve, 0, None).await; - assert_eq!(bob_approve.is_ok(), true); - - let balance = build_message::(token_account_id.clone()) - .call(|contract| { - contract.balance_of(ink_e2e::account_id(ink_e2e::AccountKeyring::Bob)) - }); - let bob_balance = client.call_dry_run(bob_borrow, &balance, 0, None).await; - assert_eq!(bob_balance.return_value(), 10000); - - let deposit = build_message::(escrow_account_id.clone()) - .call(|contract| contract.deposit()); - let bob_deposit = client.call(bob_borrow, deposit, 0, None).await; - assert_eq!(bob_deposit.is_ok(), true); - - let unlock = build_message::(escrow_account_id.clone()) - .call(|contract| contract.unlock()); - let alice_unlock = client.call(&mut ink_e2e::alice(), unlock, 0, None).await; - assert_eq!(alice_unlock.is_ok(), true); - - let release = build_message::(escrow_account_id.clone()) - .call(|contract| contract.release()); - let charlie_release = client.call(&mut ink_e2e::charlie(), release, 0, None).await; - assert_eq!(charlie_release.is_ok(), true); - - let charlie_balance = build_message::( - token_account_id.clone(), - ) - .call(|contract| { - contract.balance_of(ink_e2e::account_id(ink_e2e::AccountKeyring::Charlie)) - }); - let charlie_balance_ret = client - .call_dry_run(&mut ink_e2e::charlie(), &charlie_balance, 0, None) - .await; - assert_eq!(charlie_balance_ret.return_value(), 1000); - - Ok(()) - } - } } diff --git a/test-cases/unrestricted-transfer-from/unrestricted-transfer-from-1/vulnerable-example/src/lib.rs b/test-cases/unrestricted-transfer-from/unrestricted-transfer-from-1/vulnerable-example/src/lib.rs index 0f3df44a..9367502e 100755 --- a/test-cases/unrestricted-transfer-from/unrestricted-transfer-from-1/vulnerable-example/src/lib.rs +++ b/test-cases/unrestricted-transfer-from/unrestricted-transfer-from-1/vulnerable-example/src/lib.rs @@ -236,92 +236,4 @@ mod unrestricted_transfer_from { } } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use ink_e2e::build_message; - use openbrush::contracts::psp22::psp22_external::PSP22; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test(additional_contracts = "./psp22/Cargo.toml")] - async fn e2e_test(mut client: ink_e2e::Client) -> E2EResult<()> { - let token_constructor = psp22::psp22::ContractRef::new(10000); - let bob_borrow = &mut ink_e2e::bob(); - let token_account_id = client - .instantiate( - "psp22_base_contract", - bob_borrow, - token_constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - let escrow_constructor = UnrestrictedTransferFromRef::new( - ink_e2e::account_id(ink_e2e::AccountKeyring::Bob), - ink_e2e::account_id(ink_e2e::AccountKeyring::Charlie), - ink_e2e::account_id(ink_e2e::AccountKeyring::Alice), - token_account_id, - 1000, - ); - - let escrow_account_id = client - .instantiate( - "unrestricted_transfer_from", - &mut ink_e2e::alice(), - escrow_constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - - let approve = build_message::(token_account_id.clone()) - .call(|contract| contract.approve(escrow_account_id, 1000)); - let bob_approve = client.call(bob_borrow, approve, 0, None).await; - assert_eq!(bob_approve.is_ok(), true); - - let balance = build_message::(token_account_id.clone()) - .call(|contract| { - contract.balance_of(ink_e2e::account_id(ink_e2e::AccountKeyring::Bob)) - }); - let bob_balance = client.call_dry_run(bob_borrow, &balance, 0, None).await; - assert_eq!(bob_balance.return_value(), 10000); - - let deposit = build_message::(escrow_account_id.clone()) - .call(|contract| { - contract.deposit(ink_e2e::account_id(ink_e2e::AccountKeyring::Bob)) - }); - let bob_deposit = client.call(bob_borrow, deposit, 0, None).await; - assert_eq!(bob_deposit.is_ok(), true); - - let unlock = build_message::(escrow_account_id.clone()) - .call(|contract| contract.unlock()); - let alice_unlock = client.call(&mut ink_e2e::alice(), unlock, 0, None).await; - assert_eq!(alice_unlock.is_ok(), true); - - let release = build_message::(escrow_account_id.clone()) - .call(|contract| contract.release()); - let charlie_release = client.call(&mut ink_e2e::charlie(), release, 0, None).await; - assert_eq!(charlie_release.is_ok(), true); - - let charlie_balance = build_message::( - token_account_id.clone(), - ) - .call(|contract| { - contract.balance_of(ink_e2e::account_id(ink_e2e::AccountKeyring::Charlie)) - }); - let charlie_balance_ret = client - .call_dry_run(&mut ink_e2e::charlie(), &charlie_balance, 0, None) - .await; - assert_eq!(charlie_balance_ret.return_value(), 1000); - - Ok(()) - } - } } diff --git a/test-cases/unsafe-expect/unsafe-expect-1/remediated-example/Cargo.toml b/test-cases/unsafe-expect/unsafe-expect-1/remediated-example/Cargo.toml index e698044f..1902be7d 100644 --- a/test-cases/unsafe-expect/unsafe-expect-1/remediated-example/Cargo.toml +++ b/test-cases/unsafe-expect/unsafe-expect-1/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "unsafe-expect-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "unsafe-expect-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/unsafe-expect/unsafe-expect-1/remediated-example/src/lib.rs b/test-cases/unsafe-expect/unsafe-expect-1/remediated-example/src/lib.rs index 62f7b0ad..d8d48f16 100644 --- a/test-cases/unsafe-expect/unsafe-expect-1/remediated-example/src/lib.rs +++ b/test-cases/unsafe-expect/unsafe-expect-1/remediated-example/src/lib.rs @@ -117,124 +117,4 @@ mod unsafe_expect { ); } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn constructor_works(mut client: ink_e2e::Client) -> E2EResult<()> { - // Arrange - let initial_balance = 100; - - // Act - let constructor = UnsafeExpectRef::new(initial_balance); - let contract_acc_id = client - .instantiate("unsafe-expect", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - // Assert - let alice_account_id = ink_e2e::alice::() - .account_id() - .0 - .into(); - let balance_of_alice_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.balance_of(alice_account_id)); - let balance_of_alice = client - .call_dry_run(&ink_e2e::alice(), &balance_of_alice_call, 0, None) - .await; - - assert_eq!(balance_of_alice.return_value(), initial_balance); - - Ok(()) - } - - #[ink_e2e::test] - async fn balance_of_returns_0_on_unknown_account( - mut client: ink_e2e::Client, - ) -> E2EResult<()> { - // Arrange - let initial_balance = 100; - - // Act - let constructor = UnsafeExpectRef::new(initial_balance); - let contract_acc_id = client - .instantiate("unsafe-expect", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - // Assert - let bob_account_id = ink_e2e::bob::() - .account_id() - .0 - .into(); - let balance_of_bob_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.balance_of(bob_account_id)); - let balance_of_bob = client - .call_dry_run(&ink_e2e::bob(), &balance_of_bob_call, 0, None) - .await; - - assert_eq!(balance_of_bob.return_value(), 0); - - Ok(()) - } - - #[ink_e2e::test] - async fn transfer_works(mut client: ink_e2e::Client) -> E2EResult<()> { - // Arrange - let initial_balance = 100; - let transfer_amount = 40; - - let alice_account_id = ink_e2e::alice::() - .account_id() - .0 - .into(); - let bob_account_id = ink_e2e::bob::() - .account_id() - .0 - .into(); - - // Act - let constructor = UnsafeExpectRef::new(initial_balance); - let contract_acc_id = client - .instantiate("unsafe-expect", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - let transfer_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.transfer(bob_account_id, transfer_amount)); - client - .call(&ink_e2e::alice(), transfer_call, 0, None) - .await - .expect("transfer failed"); - - // Assert - let balance_of_alice_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.balance_of(alice_account_id)); - let balance_of_alice = client - .call_dry_run(&ink_e2e::alice(), &balance_of_alice_call, 0, None) - .await; - let balance_of_bob_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.balance_of(bob_account_id)); - let balance_of_bob = client - .call_dry_run(&ink_e2e::bob(), &balance_of_bob_call, 0, None) - .await; - - assert_eq!( - balance_of_alice.return_value(), - initial_balance - transfer_amount - ); - assert_eq!(balance_of_bob.return_value(), transfer_amount); - - Ok(()) - } - } } diff --git a/test-cases/unsafe-expect/unsafe-expect-1/vulnerable-example/Cargo.toml b/test-cases/unsafe-expect/unsafe-expect-1/vulnerable-example/Cargo.toml index ef3d68b8..68bce07e 100644 --- a/test-cases/unsafe-expect/unsafe-expect-1/vulnerable-example/Cargo.toml +++ b/test-cases/unsafe-expect/unsafe-expect-1/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "unsafe-expect-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "unsafe-expect-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/unsafe-expect/unsafe-expect-1/vulnerable-example/src/lib.rs b/test-cases/unsafe-expect/unsafe-expect-1/vulnerable-example/src/lib.rs index e7f64d57..4432a33a 100644 --- a/test-cases/unsafe-expect/unsafe-expect-1/vulnerable-example/src/lib.rs +++ b/test-cases/unsafe-expect/unsafe-expect-1/vulnerable-example/src/lib.rs @@ -108,104 +108,4 @@ mod unsafe_expect { .expect("transfer failed"); } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn constructor_works(mut client: ink_e2e::Client) -> E2EResult<()> { - // Arrange - let initial_balance = 100; - - // Act - let constructor = UnsafeExpectRef::new(initial_balance); - let contract_acc_id = client - .instantiate("unsafe-expect", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - // Assert - let alice_account_id = ink_e2e::alice::() - .account_id() - .0 - .into(); - let balance_of_alice_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.balance_of(alice_account_id)); - let balance_of_alice = client - .call_dry_run(&ink_e2e::alice(), &balance_of_alice_call, 0, None) - .await; - - assert_eq!(balance_of_alice.return_value(), initial_balance); - - Ok(()) - } - - #[ink_e2e::test] - async fn balance_of_panics_on_unknown_account( - mut client: ink_e2e::Client, - ) -> E2EResult<()> { - // Arrange - let initial_balance = 100; - - // Act - let constructor = UnsafeExpectRef::new(initial_balance); - let contract_acc_id = client - .instantiate("unsafe-expect", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - // Assert - let bob_account_id = ink_e2e::bob::() - .account_id() - .0 - .into(); - let balance_of_bob_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.balance_of(bob_account_id)); - let balance_of_bob = client - .call(&ink_e2e::alice(), balance_of_bob_call, 0, None) - .await; - - assert!(balance_of_bob.is_err()); - - Ok(()) - } - - #[ink_e2e::test] - async fn transfer_panics_to_unknown_account( - mut client: ink_e2e::Client, - ) -> E2EResult<()> { - // Arrange - let initial_balance = 100; - let transfer_amount = 40; - - let bob_account_id = ink_e2e::bob::() - .account_id() - .0 - .into(); - - // Act - let constructor = UnsafeExpectRef::new(initial_balance); - let contract_acc_id = client - .instantiate("unsafe-expect", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - let transfer_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.transfer(bob_account_id, transfer_amount)); - let transfer_result = client.call(&ink_e2e::alice(), transfer_call, 0, None).await; - - // Assert - assert!(transfer_result.is_err()); - - Ok(()) - } - } } diff --git a/test-cases/unsafe-unwrap/unsafe-unwrap-1/remediated-example/Cargo.toml b/test-cases/unsafe-unwrap/unsafe-unwrap-1/remediated-example/Cargo.toml index fc4ff0aa..9128dade 100644 --- a/test-cases/unsafe-unwrap/unsafe-unwrap-1/remediated-example/Cargo.toml +++ b/test-cases/unsafe-unwrap/unsafe-unwrap-1/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "unsafe-unwrap-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "unsafe-unwrap-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/unsafe-unwrap/unsafe-unwrap-1/remediated-example/src/lib.rs b/test-cases/unsafe-unwrap/unsafe-unwrap-1/remediated-example/src/lib.rs index 9403c013..66e053da 100644 --- a/test-cases/unsafe-unwrap/unsafe-unwrap-1/remediated-example/src/lib.rs +++ b/test-cases/unsafe-unwrap/unsafe-unwrap-1/remediated-example/src/lib.rs @@ -117,124 +117,4 @@ mod unsafe_unwrap { ); } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn constructor_works(mut client: ink_e2e::Client) -> E2EResult<()> { - // Arrange - let initial_balance = 100; - - // Act - let constructor = UnsafeUnwrapRef::new(initial_balance); - let contract_acc_id = client - .instantiate("unsafe-unwrap", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - // Assert - let alice_account_id = ink_e2e::alice::() - .account_id() - .0 - .into(); - let balance_of_alice_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.balance_of(alice_account_id)); - let balance_of_alice = client - .call_dry_run(&ink_e2e::alice(), &balance_of_alice_call, 0, None) - .await; - - assert_eq!(balance_of_alice.return_value(), initial_balance); - - Ok(()) - } - - #[ink_e2e::test] - async fn balance_of_returns_0_on_unknown_account( - mut client: ink_e2e::Client, - ) -> E2EResult<()> { - // Arrange - let initial_balance = 100; - - // Act - let constructor = UnsafeUnwrapRef::new(initial_balance); - let contract_acc_id = client - .instantiate("unsafe-unwrap", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - // Assert - let bob_account_id = ink_e2e::bob::() - .account_id() - .0 - .into(); - let balance_of_bob_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.balance_of(bob_account_id)); - let balance_of_bob = client - .call_dry_run(&ink_e2e::bob(), &balance_of_bob_call, 0, None) - .await; - - assert_eq!(balance_of_bob.return_value(), 0); - - Ok(()) - } - - #[ink_e2e::test] - async fn transfer_works(mut client: ink_e2e::Client) -> E2EResult<()> { - // Arrange - let initial_balance = 100; - let transfer_amount = 40; - - let alice_account_id = ink_e2e::alice::() - .account_id() - .0 - .into(); - let bob_account_id = ink_e2e::bob::() - .account_id() - .0 - .into(); - - // Act - let constructor = UnsafeUnwrapRef::new(initial_balance); - let contract_acc_id = client - .instantiate("unsafe-unwrap", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - let transfer_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.transfer(bob_account_id, transfer_amount)); - client - .call(&ink_e2e::alice(), transfer_call, 0, None) - .await - .expect("transfer failed"); - - // Assert - let balance_of_alice_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.balance_of(alice_account_id)); - let balance_of_alice = client - .call_dry_run(&ink_e2e::alice(), &balance_of_alice_call, 0, None) - .await; - let balance_of_bob_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.balance_of(bob_account_id)); - let balance_of_bob = client - .call_dry_run(&ink_e2e::bob(), &balance_of_bob_call, 0, None) - .await; - - assert_eq!( - balance_of_alice.return_value(), - initial_balance - transfer_amount - ); - assert_eq!(balance_of_bob.return_value(), transfer_amount); - - Ok(()) - } - } } diff --git a/test-cases/unsafe-unwrap/unsafe-unwrap-1/vulnerable-example/Cargo.toml b/test-cases/unsafe-unwrap/unsafe-unwrap-1/vulnerable-example/Cargo.toml index 802eb008..0652440b 100644 --- a/test-cases/unsafe-unwrap/unsafe-unwrap-1/vulnerable-example/Cargo.toml +++ b/test-cases/unsafe-unwrap/unsafe-unwrap-1/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "unsafe-unwrap-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "unsafe-unwrap-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/unsafe-unwrap/unsafe-unwrap-1/vulnerable-example/src/lib.rs b/test-cases/unsafe-unwrap/unsafe-unwrap-1/vulnerable-example/src/lib.rs index 8a65f425..d724f9f7 100644 --- a/test-cases/unsafe-unwrap/unsafe-unwrap-1/vulnerable-example/src/lib.rs +++ b/test-cases/unsafe-unwrap/unsafe-unwrap-1/vulnerable-example/src/lib.rs @@ -105,104 +105,4 @@ mod unsafe_unwrap { .unwrap(); } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn constructor_works(mut client: ink_e2e::Client) -> E2EResult<()> { - // Arrange - let initial_balance = 100; - - // Act - let constructor = UnsafeUnwrapRef::new(initial_balance); - let contract_acc_id = client - .instantiate("unsafe-unwrap", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - // Assert - let alice_account_id = ink_e2e::alice::() - .account_id() - .0 - .into(); - let balance_of_alice_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.balance_of(alice_account_id)); - let balance_of_alice = client - .call_dry_run(&ink_e2e::alice(), &balance_of_alice_call, 0, None) - .await; - - assert_eq!(balance_of_alice.return_value(), initial_balance); - - Ok(()) - } - - #[ink_e2e::test] - async fn balance_of_unwraps_on_unknown_account( - mut client: ink_e2e::Client, - ) -> E2EResult<()> { - // Arrange - let initial_balance = 100; - - // Act - let constructor = UnsafeUnwrapRef::new(initial_balance); - let contract_acc_id = client - .instantiate("unsafe-unwrap", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - // Assert - let bob_account_id = ink_e2e::bob::() - .account_id() - .0 - .into(); - let balance_of_bob_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.balance_of(bob_account_id)); - let balance_of_bob = client - .call(&ink_e2e::alice(), balance_of_bob_call, 0, None) - .await; - - assert!(balance_of_bob.is_err()); - - Ok(()) - } - - #[ink_e2e::test] - async fn transfer_unwraps_to_unknown_account( - mut client: ink_e2e::Client, - ) -> E2EResult<()> { - // Arrange - let initial_balance = 100; - let transfer_amount = 40; - - let bob_account_id = ink_e2e::bob::() - .account_id() - .0 - .into(); - - // Act - let constructor = UnsafeUnwrapRef::new(initial_balance); - let contract_acc_id = client - .instantiate("unsafe-unwrap", &ink_e2e::alice(), constructor, 0, None) - .await - .expect("instantiate failed") - .account_id; - - let transfer_call = build_message::(contract_acc_id.clone()) - .call(|contract| contract.transfer(bob_account_id, transfer_amount)); - let transfer_result = client.call(&ink_e2e::alice(), transfer_call, 0, None).await; - - // Assert - assert!(transfer_result.is_err()); - - Ok(()) - } - } } diff --git a/test-cases/unused-return-enum/unused-return-enum-1/remediated-example/Cargo.toml b/test-cases/unused-return-enum/unused-return-enum-1/remediated-example/Cargo.toml index ec909e5c..03db1964 100644 --- a/test-cases/unused-return-enum/unused-return-enum-1/remediated-example/Cargo.toml +++ b/test-cases/unused-return-enum/unused-return-enum-1/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "unused-return-enum-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "unused-return-enum-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/unused-return-enum/unused-return-enum-1/remediated-example/src/lib.rs b/test-cases/unused-return-enum/unused-return-enum-1/remediated-example/src/lib.rs index c26e70de..a43c13f1 100644 --- a/test-cases/unused-return-enum/unused-return-enum-1/remediated-example/src/lib.rs +++ b/test-cases/unused-return-enum/unused-return-enum-1/remediated-example/src/lib.rs @@ -54,47 +54,4 @@ mod unused_return_enum { assert_eq!(result, Ok(0)); } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn get_percentage_difference_panics( - mut client: ink_e2e::Client, - ) -> E2EResult<()> { - // Arrange - let constructor = UnusedReturnEnumRef::new(); - let contract_acc_id = client - .instantiate( - "unused-return-enum", - &ink_e2e::alice(), - constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - - // Act - let value1 = 100; - let value2 = 150; - let get_percentage_difference = - build_message::(contract_acc_id.clone()) - .call(|contract| contract.get_percentage_difference(value1, value2)); - let result = client - .call(&ink_e2e::alice(), get_percentage_difference, 0, None) - .await; - - // Assert - assert!(result.is_ok()); - - Ok(()) - } - } } diff --git a/test-cases/unused-return-enum/unused-return-enum-1/vulnerable-example/Cargo.toml b/test-cases/unused-return-enum/unused-return-enum-1/vulnerable-example/Cargo.toml index 7c43c07e..e39fde96 100644 --- a/test-cases/unused-return-enum/unused-return-enum-1/vulnerable-example/Cargo.toml +++ b/test-cases/unused-return-enum/unused-return-enum-1/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "unused-return-enum-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "unused-return-enum-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/unused-return-enum/unused-return-enum-1/vulnerable-example/src/lib.rs b/test-cases/unused-return-enum/unused-return-enum-1/vulnerable-example/src/lib.rs index be620915..b4c6b8be 100644 --- a/test-cases/unused-return-enum/unused-return-enum-1/vulnerable-example/src/lib.rs +++ b/test-cases/unused-return-enum/unused-return-enum-1/vulnerable-example/src/lib.rs @@ -55,45 +55,4 @@ mod unused_return_enum { assert_eq!(result, Err(Error::Overflow)); } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn add_panics(mut client: ink_e2e::Client) -> E2EResult<()> { - // Arrange - let constructor = UnusedReturnEnumRef::new(); - let contract_acc_id = client - .instantiate( - "unused-return-enum", - &ink_e2e::alice(), - constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - - // Act - let value1 = 100; - let value2 = 150; - let get_percentage_difference = - build_message::(contract_acc_id.clone()) - .call(|contract| contract.get_percentage_difference(value1, value2)); - let result = client - .call(&ink_e2e::alice(), get_percentage_difference, 0, None) - .await; - - // Assert - assert!(result.is_err()); - - Ok(()) - } - } } diff --git a/test-cases/unused-return-enum/unused-return-enum-2/remediated-example/Cargo.toml b/test-cases/unused-return-enum/unused-return-enum-2/remediated-example/Cargo.toml index 7f1602e4..88d92bcd 100644 --- a/test-cases/unused-return-enum/unused-return-enum-2/remediated-example/Cargo.toml +++ b/test-cases/unused-return-enum/unused-return-enum-2/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] +edition = "2021" name = "unused-return-enum-remediated-2" version = "0.1.0" -edition = "2021" -authors = ["[your_name] <[your_email]>"] [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/unused-return-enum/unused-return-enum-2/remediated-example/src/lib.rs b/test-cases/unused-return-enum/unused-return-enum-2/remediated-example/src/lib.rs index 16fe5010..97a8d495 100644 --- a/test-cases/unused-return-enum/unused-return-enum-2/remediated-example/src/lib.rs +++ b/test-cases/unused-return-enum/unused-return-enum-2/remediated-example/src/lib.rs @@ -54,47 +54,4 @@ mod unused_return_enum { assert_eq!(result, Ok(0)); } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn get_percentage_difference_panics( - mut client: ink_e2e::Client, - ) -> E2EResult<()> { - // Arrange - let constructor = UnusedReturnEnumRef::new(); - let contract_acc_id = client - .instantiate( - "unused-return-enum", - &ink_e2e::alice(), - constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - - // Act - let value1 = 100; - let value2 = 150; - let get_percentage_difference = - build_message::(contract_acc_id.clone()) - .call(|contract| contract.get_percentage_difference(value1, value2)); - let result = client - .call(&ink_e2e::alice(), get_percentage_difference, 0, None) - .await; - - // Assert - assert!(result.is_ok()); - - Ok(()) - } - } } diff --git a/test-cases/unused-return-enum/unused-return-enum-2/vulnerable-example/Cargo.toml b/test-cases/unused-return-enum/unused-return-enum-2/vulnerable-example/Cargo.toml index 1702a2e8..4b7f7454 100644 --- a/test-cases/unused-return-enum/unused-return-enum-2/vulnerable-example/Cargo.toml +++ b/test-cases/unused-return-enum/unused-return-enum-2/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] +edition = "2021" name = "unused-return-enum-vulnerable-2" version = "0.1.0" -edition = "2021" -authors = ["[your_name] <[your_email]>"] [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/unused-return-enum/unused-return-enum-2/vulnerable-example/src/lib.rs b/test-cases/unused-return-enum/unused-return-enum-2/vulnerable-example/src/lib.rs index be620915..b4c6b8be 100644 --- a/test-cases/unused-return-enum/unused-return-enum-2/vulnerable-example/src/lib.rs +++ b/test-cases/unused-return-enum/unused-return-enum-2/vulnerable-example/src/lib.rs @@ -55,45 +55,4 @@ mod unused_return_enum { assert_eq!(result, Err(Error::Overflow)); } } - - #[cfg(all(test, feature = "e2e-tests"))] - mod e2e_tests { - use ink_e2e::build_message; - - use super::*; - - type E2EResult = std::result::Result>; - - #[ink_e2e::test] - async fn add_panics(mut client: ink_e2e::Client) -> E2EResult<()> { - // Arrange - let constructor = UnusedReturnEnumRef::new(); - let contract_acc_id = client - .instantiate( - "unused-return-enum", - &ink_e2e::alice(), - constructor, - 0, - None, - ) - .await - .expect("instantiate failed") - .account_id; - - // Act - let value1 = 100; - let value2 = 150; - let get_percentage_difference = - build_message::(contract_acc_id.clone()) - .call(|contract| contract.get_percentage_difference(value1, value2)); - let result = client - .call(&ink_e2e::alice(), get_percentage_difference, 0, None) - .await; - - // Assert - assert!(result.is_err()); - - Ok(()) - } - } } diff --git a/test-cases/vec-could-be-mapping/vec-could-be-mapping-1/remediated-example/Cargo.toml b/test-cases/vec-could-be-mapping/vec-could-be-mapping-1/remediated-example/Cargo.toml index e6e704a5..23e7523f 100644 --- a/test-cases/vec-could-be-mapping/vec-could-be-mapping-1/remediated-example/Cargo.toml +++ b/test-cases/vec-could-be-mapping/vec-could-be-mapping-1/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "vec-could-be-mapping-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "vec-could-be-mapping-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/vec-could-be-mapping/vec-could-be-mapping-1/vulnerable-example/Cargo.toml b/test-cases/vec-could-be-mapping/vec-could-be-mapping-1/vulnerable-example/Cargo.toml index c91b5056..cca6e08b 100644 --- a/test-cases/vec-could-be-mapping/vec-could-be-mapping-1/vulnerable-example/Cargo.toml +++ b/test-cases/vec-could-be-mapping/vec-could-be-mapping-1/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "vec-could-be-mapping-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "vec-could-be-mapping-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/warning-sr25519-verify/warning-sr25519-verify-1/remediated-example/Cargo.toml b/test-cases/warning-sr25519-verify/warning-sr25519-verify-1/remediated-example/Cargo.toml index 5254000d..24a2d645 100644 --- a/test-cases/warning-sr25519-verify/warning-sr25519-verify-1/remediated-example/Cargo.toml +++ b/test-cases/warning-sr25519-verify/warning-sr25519-verify-1/remediated-example/Cargo.toml @@ -1,21 +1,16 @@ [package] +edition = "2021" name = "warning-sr25519-verify-remediated-1" version = "0.1.0" -edition = "2021" -authors = ["[your_name] <[your_email]>"] [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } diff --git a/test-cases/warning-sr25519-verify/warning-sr25519-verify-1/vulnerable-example/Cargo.toml b/test-cases/warning-sr25519-verify/warning-sr25519-verify-1/vulnerable-example/Cargo.toml index c4e6033d..bea257b1 100644 --- a/test-cases/warning-sr25519-verify/warning-sr25519-verify-1/vulnerable-example/Cargo.toml +++ b/test-cases/warning-sr25519-verify/warning-sr25519-verify-1/vulnerable-example/Cargo.toml @@ -1,21 +1,16 @@ [package] +edition = "2021" name = "warning-sr25519-verify-vulnerable-1" version = "0.1.0" -edition = "2021" -authors = ["[your_name] <[your_email]>"] [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } diff --git a/test-cases/zero-or-test-address/zero-or-test-address-1/remediated-example/Cargo.toml b/test-cases/zero-or-test-address/zero-or-test-address-1/remediated-example/Cargo.toml index 05f93947..0fc18c48 100755 --- a/test-cases/zero-or-test-address/zero-or-test-address-1/remediated-example/Cargo.toml +++ b/test-cases/zero-or-test-address/zero-or-test-address-1/remediated-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "zerocheck-remediated" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "zero-or-test-address-remediated-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true } diff --git a/test-cases/zero-or-test-address/zero-or-test-address-1/vulnerable-example/Cargo.toml b/test-cases/zero-or-test-address/zero-or-test-address-1/vulnerable-example/Cargo.toml index 439f2d43..aeb31404 100755 --- a/test-cases/zero-or-test-address/zero-or-test-address-1/vulnerable-example/Cargo.toml +++ b/test-cases/zero-or-test-address/zero-or-test-address-1/vulnerable-example/Cargo.toml @@ -1,26 +1,18 @@ [package] -name = "zerocheck-vulnerable" -version = "0.1.0" edition = "2021" -authors = ["[your_name] <[your_email]>"] +name = "zero-or-test-address-vulnerable-1" +version = "0.1.0" [lib] path = "src/lib.rs" [features] +__ink_dylint_Constructor = [] +__ink_dylint_Storage = [] default = ["std"] -std = [ - "ink/std", - "scale/std", - "scale-info/std", -] -ink-as-dependency = [] -e2e-tests = [] +std = ["ink/std", "scale-info/std", "scale/std"] [dependencies] ink = { workspace = true } scale = { workspace = true } scale-info = { workspace = true } - -[dev-dependencies] -ink_e2e = { workspace = true }