Skip to content

Commit 9669999

Browse files
committed
feat: add minor updates (#11)
* chore: exclude idea configuration files from VCS Signed-off-by: Luca Georges Francois <luca@quartz.technology> * docs: update implementation status table Signed-off-by: Luca Georges Francois <luca@quartz.technology> * feat: add empty mutation grapher Signed-off-by: Luca Georges Francois <luca@quartz.technology> --------- Signed-off-by: Luca Georges Francois <luca@quartz.technology>
1 parent d0aef2e commit 9669999

File tree

6 files changed

+35
-7
lines changed

6 files changed

+35
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ Cargo.lock
1414
*.pdb
1515

1616
.DS_Store
17+
.idea/

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ Cover by [DALL-E](https://openai.com/dall-e-2/).
1515
We want to help Solidity developers write better smart contracts.
1616
Various tools have been developed with this goal in mind: [Foundry](https://github.com/foundry-rs/foundry), [Slither](https://github.com/crytic/slither), [Heimdall](https://github.com/Jon-Becker/heimdall-rs) and so many more.
1717

18-
The release of the [alloy-rs core librairies](https://github.com/alloy-rs/core) gave us the opportunity to experiment with the Solidity AST in Rust and we immediatly knew that we could build something upon it.
18+
The release of the [alloy-rs core libraries](https://github.com/alloy-rs/core) gave us the opportunity to experiment with the Solidity AST in Rust, and we immediately knew that we could build something upon it.
1919

2020
We opted for a project able to evolve and scale. A software able to perform various scans on Solidity code - using the AST - and report valuable information to the developer.
2121

2222
Soliris does not aim to be specialized in one single topic and should preferably hold scanners with different purposes: improving code syntax, giving more context about the contract's state, propose memory improvements and more.
2323
But we also acknowledge the limitations of the solution: it will never replace a compiler, nor a dedicated security tool such as Slither.
24-
It's more of a serious test demontrating the possibilities of [syn-solidity](https://github.com/alloy-rs/core/tree/main/crates/syn-solidity).
24+
It's more of a serious test demonstrating the possibilities of [syn-solidity](https://github.com/alloy-rs/core/tree/main/crates/syn-solidity).
2525

2626
## Development Status
2727

@@ -34,9 +34,9 @@ Below is a list of the scanners implementation statuses:
3434
| Name | Goal | Status |
3535
|:-------------------:|----------------------------------------------------------------------------------------------------------------|:--------:|
3636
| Missing Comments | Reports missing comments in your code. ||
37-
| Unused Imports | Reports unused `import` declarations in your contracts. ||
3837
| Mutable Functions | Reports functions able to mutate your contract's state. ||
3938
| Mutable Variables | Reports variables likely to mutate. ||
39+
| Unused Imports | Reports unused `import` declarations in your contracts. ||
4040
| Mutation Grapher | Creates a graph showing the variables likely to mutate connected to the places where they undergo mutations. ||
4141
| Struct Repacker | Suggests an alternative way to define a struct such that it takes less storage slots. ||
4242

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
pub mod missing_comments;
22
pub mod mutable_functions;
33
pub mod mutable_variables;
4+
pub mod mutation_grapher;
45
pub mod struct_repacker;
56
pub mod unused_imports;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use syn_solidity::Item;
2+
3+
use crate::scanners::{memory::Metadata, Scanner};
4+
5+
#[derive(Default)]
6+
pub struct MutationGrapher {}
7+
8+
impl MutationGrapher {}
9+
10+
impl Scanner for MutationGrapher {
11+
fn execute(&self, _ast: &[Item], _metadata: &Metadata) {
12+
println!("todo!")
13+
}
14+
}

src/scanners/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ pub mod memory;
33

44
use self::implementations::{
55
missing_comments::MissingComments, mutable_functions::MutableFunctions,
6-
mutable_variables::MutableVariables, struct_repacker::StructRepacker,
7-
unused_imports::UnusedImports,
6+
mutable_variables::MutableVariables, mutation_grapher::MutationGrapher,
7+
struct_repacker::StructRepacker, unused_imports::UnusedImports,
88
};
99
use crate::scanners::memory::Metadata;
1010
use syn_solidity::Item;
@@ -37,6 +37,7 @@ impl Default for Registry {
3737
Box::<MutableVariables>::default(),
3838
Box::<MutableFunctions>::default(),
3939
Box::<StructRepacker>::default(),
40+
Box::<MutationGrapher>::default(),
4041
],
4142
}
4243
}
@@ -60,7 +61,7 @@ mod tests {
6061
fn it_creates_default_scanners_registry() {
6162
let scanners_registry = Registry::default();
6263

63-
assert_eq!(scanners_registry.get_scanners().len(), 5)
64+
assert_eq!(scanners_registry.get_scanners().len(), 6)
6465
}
6566

6667
#[test]
@@ -69,6 +70,6 @@ mod tests {
6970

7071
scanners_registry.register_scanner(Box::new(MockScanner::default()));
7172

72-
assert_eq!(scanners_registry.get_scanners().len(), 6)
73+
assert_eq!(scanners_registry.get_scanners().len(), 7)
7374
}
7475
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
3+
pragma solidity ^0.8.15;
4+
5+
function IsAmethystBeautiful() public returns (bool) {
6+
return true;
7+
}
8+
9+
contract MutableContract {
10+
11+
}

0 commit comments

Comments
 (0)