Skip to content

Commit

Permalink
Update ink_linting toolchain (#2112)
Browse files Browse the repository at this point in the history
* chore: remove redundant file

* feat: Update `clippy_utils`

* feat: Unpin `curve25519-dalek`

* feat: Update linting toolchain

* chore: Remove a redundant file

* feat(linter): Support a new version of toolchain

* chore: Clippy warning

* chore: Unpin `curve25519-dalek`
  • Loading branch information
jubnzv authored Apr 24, 2024
1 parent e528a87 commit ef91c60
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
7 changes: 1 addition & 6 deletions linting/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@ keywords = ["parity", "blockchain", "edsl", "dylint", "linting"]

[workspace.dependencies]
ink_linting_utils = { version = "=5.0.0", path = "utils" }
curve25519-dalek = { version = "=4.1.1", default-features = false, features = [
"digest",
"zeroize",
"precomputed-tables",
"legacy_compatibility",
] }

[workspace.metadata.dylint]
libraries = [
{ path = "mandatory" },
Expand Down
18 changes: 13 additions & 5 deletions linting/extra/src/strict_balance_equality.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ use rustc_session::{
declare_lint,
declare_lint_pass,
};
use rustc_span::Span;
use rustc_span::{
source_map::Spanned,
Span,
};
use std::collections::{
HashMap,
HashSet,
Expand Down Expand Up @@ -394,7 +397,7 @@ impl<'tcx> TransferFunction<'_, 'tcx> {
// with balance after calling the function.
fn get_tainted_input_args(
&self,
input_args: &[Operand],
input_args: &[Spanned<Operand<'_>>],
fn_mir: &Body,
fn_state: &BitSet<Local>,
) -> Vec<Local> {
Expand All @@ -403,7 +406,7 @@ impl<'tcx> TransferFunction<'_, 'tcx> {
|mut acc, (caller_op, callee_local)| {
if_chain! {
if fn_state.contains(callee_local);
if let Some(caller_place) = caller_op.place();
if let Some(caller_place) = caller_op.node.place();
then {
let ref_local = caller_place.local;
acc.push(ref_local);
Expand All @@ -421,9 +424,14 @@ impl<'tcx> TransferFunction<'_, 'tcx> {
fn_def_id.is_local()
}

fn visit_call(&mut self, func: &ConstOperand, args: &[Operand], destination: &Place) {
fn visit_call(
&mut self,
func: &ConstOperand,
args: &[Spanned<Operand<'_>>],
destination: &Place,
) {
let init_taints = args.iter().fold(Vec::new(), |mut acc, arg| {
if let Operand::Move(place) | Operand::Copy(place) = arg {
if let Operand::Move(place) | Operand::Copy(place) = arg.node {
acc.push(self.state.contains(place.local))
}
acc
Expand Down
1 change: 0 additions & 1 deletion linting/mandatory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ if_chain = "1.0.2"
log = "0.4.14"
regex = "1.5.4"
ink_linting_utils = { workspace = true }
curve25519-dalek = { workspace = true }

[dev-dependencies]
dylint_testing = "2.6.0"
Expand Down
2 changes: 1 addition & 1 deletion linting/rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# https://github.com/trailofbits/dylint/blob/ef7210cb08aac920c18d2141604efe210029f2a2/internal/template/rust-toolchain

[toolchain]
channel = "nightly-2023-12-28"
channel = "nightly-2024-02-08"
components = ["llvm-tools-preview", "rustc-dev"]
2 changes: 1 addition & 1 deletion linting/utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ include = ["Cargo.toml", "*.rs", "LICENSE"]

[dependencies]
if_chain = "1.0.2"
parity_clippy_utils = { package = "clippy_utils", git = "https://github.com/rust-lang/rust-clippy", rev = "3fceca23bb64e304df56b3bd86d26790b5301bdf" }
parity_clippy_utils = { package = "clippy_utils", git = "https://github.com/rust-lang/rust-clippy", rev = "2ca6c8419432b18474516a3b62d6d1ea46b9df78" }

[package.metadata.rust-analyzer]
rustc_private = true

0 comments on commit ef91c60

Please sign in to comment.