Skip to content

Commit 6fe7436

Browse files
committed
Apply spotless
1 parent c96e7c4 commit 6fe7436

File tree

4 files changed

+40
-29
lines changed

4 files changed

+40
-29
lines changed

src/main/java/it/unipr/EVMLiSA.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ public static void analyzeContract(SmartContract contract) {
295295
conf.semanticChecks.clear();
296296
conf.semanticChecks.add(new ReentrancyChecker());
297297
lisa.run(program);
298-
log.info("{} vulnerabilities found", MyCache.getInstance().getReentrancyWarnings(checker.getComputedCFG().hashCode()));
298+
log.info("{} vulnerabilities found",
299+
MyCache.getInstance().getReentrancyWarnings(checker.getComputedCFG().hashCode()));
299300
}
300301
if (ENABLE_TXORIGIN_CHECKER) {
301302
log.info("Running tx. origin checker...");
@@ -304,7 +305,8 @@ public static void analyzeContract(SmartContract contract) {
304305
conf.abstractState = new SimpleAbstractState<>(new MonolithicHeap(), new TxOriginAbstractDomain(),
305306
new TypeEnvironment<>(new InferredTypes()));
306307
lisa.run(program);
307-
log.info("{} vulnerabilities found", MyCache.getInstance().getTxOriginWarnings(checker.getComputedCFG().hashCode()));
308+
log.info("{} vulnerabilities found",
309+
MyCache.getInstance().getTxOriginWarnings(checker.getComputedCFG().hashCode()));
308310
}
309311
if (ENABLE_TIMESTAMPDEPENDENCY_CHECKER) {
310312
log.info("Running timestamp dependency checker...");
@@ -314,7 +316,8 @@ public static void analyzeContract(SmartContract contract) {
314316
new TimestampDependencyAbstractDomain(),
315317
new TypeEnvironment<>(new InferredTypes()));
316318
lisa.run(program);
317-
log.info("{} vulnerabilities found", MyCache.getInstance().getTimestampDependencyWarnings(checker.getComputedCFG().hashCode()));
319+
log.info("{} vulnerabilities found",
320+
MyCache.getInstance().getTimestampDependencyWarnings(checker.getComputedCFG().hashCode()));
318321
}
319322

320323
contract.setVulnerabilities(

src/main/java/it/unipr/analysis/contract/SmartContract.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ public SmartContract(String address) {
102102

103103
// Bytecode case
104104
try {
105-
// If the bytecode file does not exist, we will do an API request to Etherscan
105+
// If the bytecode file does not exist, we will do an API request to
106+
// Etherscan
106107
File file = new File(String.valueOf(_bytecodeFilePath));
107108
if (!file.exists()) {
108109
Files.createDirectories(outputDir);
@@ -121,7 +122,8 @@ public SmartContract(String address) {
121122

122123
// ABI case
123124
try {
124-
// If the ABI file does not exist, we will do an API request to Etherscan
125+
// If the ABI file does not exist, we will do an API request to
126+
// Etherscan
125127
File file = new File(String.valueOf(_abiFilePath));
126128
if (!file.exists()) {
127129
Files.createDirectories(outputDir);

src/main/java/it/unipr/utils/StatisticsObject.java

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ private StatisticsObject() {
3636
this.json = new JSONObject();
3737
}
3838

39-
4039
/**
4140
* Creates a new {@code StatisticsObject} with specified values.
4241
*
43-
* @param address the contract address
44-
* @param totalOpcodes the total number of opcodes
45-
* @param totalJumps the total number of jumps
46-
* @param resolvedJumps the number of resolved jumps
47-
* @param definitelyUnreachableJumps the number of definitely unreachable jumps
48-
* @param maybeUnreachableJumps the number of maybe unreachable jumps
49-
* @param unsoundJumps the number of unsound jumps
50-
* @param maybeUnsoundJumps the number of maybe unsound jumps
51-
* @param json the JSON representation of the object
42+
* @param address the contract address
43+
* @param totalOpcodes the total number of opcodes
44+
* @param totalJumps the total number of jumps
45+
* @param resolvedJumps the number of resolved jumps
46+
* @param definitelyUnreachableJumps the number of definitely unreachable
47+
* jumps
48+
* @param maybeUnreachableJumps the number of maybe unreachable jumps
49+
* @param unsoundJumps the number of unsound jumps
50+
* @param maybeUnsoundJumps the number of maybe unsound jumps
51+
* @param json the JSON representation of the object
5252
*/
5353
private StatisticsObject(String address, int totalOpcodes, int totalJumps, int resolvedJumps,
5454
int definitelyUnreachableJumps,
@@ -81,7 +81,6 @@ public String getAddress() {
8181
return address;
8282
}
8383

84-
8584
/**
8685
* Returns the total number of opcodes.
8786
*
@@ -154,11 +153,11 @@ public static StatisticsObject newStatisticsObject() {
154153
return new StatisticsObject();
155154
}
156155

157-
158156
/**
159157
* Sets the contract address.
160158
*
161159
* @param address the contract address
160+
*
162161
* @return the updated {@code StatisticsObject} instance
163162
*/
164163
public StatisticsObject address(String address) {
@@ -170,6 +169,7 @@ public StatisticsObject address(String address) {
170169
* Sets the total number of opcodes.
171170
*
172171
* @param totalOpcodes the total opcodes
172+
*
173173
* @return the updated {@code StatisticsObject} instance
174174
*/
175175
public StatisticsObject totalOpcodes(int totalOpcodes) {
@@ -181,18 +181,19 @@ public StatisticsObject totalOpcodes(int totalOpcodes) {
181181
* Sets the total number of jumps.
182182
*
183183
* @param totalJumps the total jumps
184+
*
184185
* @return the updated {@code StatisticsObject} instance
185186
*/
186187
public StatisticsObject totalJumps(int totalJumps) {
187188
this.totalJumps = totalJumps;
188189
return this;
189190
}
190191

191-
192192
/**
193193
* Sets the number of resolved jumps.
194194
*
195195
* @param resolvedJumps the resolved jumps
196+
*
196197
* @return the updated {@code StatisticsObject} instance
197198
*/
198199
public StatisticsObject resolvedJumps(int resolvedJumps) {
@@ -204,18 +205,19 @@ public StatisticsObject resolvedJumps(int resolvedJumps) {
204205
* Sets the number of definitely unreachable jumps.
205206
*
206207
* @param definitelyUnreachableJumps the definitely unreachable jumps
208+
*
207209
* @return the updated {@code StatisticsObject} instance
208210
*/
209211
public StatisticsObject definitelyUnreachableJumps(int definitelyUnreachableJumps) {
210212
this.definitelyUnreachableJumps = definitelyUnreachableJumps;
211213
return this;
212214
}
213215

214-
215216
/**
216217
* Sets the number of maybe unreachable jumps.
217218
*
218219
* @param maybeUnreachableJumps the maybe unreachable jumps
220+
*
219221
* @return the updated {@code StatisticsObject} instance
220222
*/
221223
public StatisticsObject maybeUnreachableJumps(int maybeUnreachableJumps) {
@@ -227,6 +229,7 @@ public StatisticsObject maybeUnreachableJumps(int maybeUnreachableJumps) {
227229
* Sets the number of unsound jumps.
228230
*
229231
* @param unsoundJumps the unsound jumps
232+
*
230233
* @return the updated {@code StatisticsObject} instance
231234
*/
232235
public StatisticsObject unsoundJumps(int unsoundJumps) {
@@ -238,6 +241,7 @@ public StatisticsObject unsoundJumps(int unsoundJumps) {
238241
* Sets the number of maybe unsound jumps.
239242
*
240243
* @param maybeUnsoundJumps the maybe unsound jumps
244+
*
241245
* @return the updated {@code StatisticsObject} instance
242246
*/
243247
public StatisticsObject maybeUnsoundJumps(int maybeUnsoundJumps) {

src/main/java/it/unipr/utils/VulnerabilitiesObject.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
import org.json.JSONObject;
66

77
/**
8-
* Represents an object that stores information about potential smart contract vulnerabilities,
9-
* including reentrancy, timestamp dependency, and tx. origin usage.
8+
* Represents an object that stores information about potential smart contract
9+
* vulnerabilities, including reentrancy, timestamp dependency, and tx. origin
10+
* usage.
1011
*/
1112
public class VulnerabilitiesObject {
1213
private static final Logger log = LogManager.getLogger(VulnerabilitiesObject.class);
@@ -17,7 +18,8 @@ public class VulnerabilitiesObject {
1718
private JSONObject json;
1819

1920
/**
20-
* Creates a new {@code VulnerabilitiesObject} with default values (-1) for all vulnerabilities.
21+
* Creates a new {@code VulnerabilitiesObject} with default values (-1) for
22+
* all vulnerabilities.
2123
*/
2224
private VulnerabilitiesObject() {
2325
this.reentrancy = -1;
@@ -29,10 +31,10 @@ private VulnerabilitiesObject() {
2931
/**
3032
* Creates a new {@code VulnerabilitiesObject} with specified values.
3133
*
32-
* @param reentrancy the reentrancy vulnerability score
33-
* @param timestamp the timestamp dependency vulnerability score
34-
* @param txOrigin the tx.origin vulnerability score
35-
* @param json the JSON representation of the object
34+
* @param reentrancy the reentrancy vulnerability score
35+
* @param timestamp the timestamp dependency vulnerability score
36+
* @param txOrigin the tx.origin vulnerability score
37+
* @param json the JSON representation of the object
3638
*/
3739
private VulnerabilitiesObject(int reentrancy, int timestamp, int txOrigin, JSONObject json) {
3840
this.reentrancy = reentrancy;
@@ -48,7 +50,6 @@ private VulnerabilitiesObject(int reentrancy, int timestamp, int txOrigin, JSONO
4850
this.json.put("tx_origin", this.txOrigin);
4951
}
5052

51-
5253
/**
5354
* Returns the reentrancy vulnerability score.
5455
*
@@ -76,7 +77,6 @@ public int getTxOrigin() {
7677
return txOrigin;
7778
}
7879

79-
8080
/**
8181
* Creates a new {@code VulnerabilitiesObject} with default values.
8282
*
@@ -90,18 +90,19 @@ public static VulnerabilitiesObject newVulnerabilitiesObject() {
9090
* Sets the reentrancy vulnerability score.
9191
*
9292
* @param reentrancy the reentrancy score
93+
*
9394
* @return the updated {@code VulnerabilitiesObject} instance
9495
*/
9596
public VulnerabilitiesObject reentrancy(int reentrancy) {
9697
this.reentrancy = reentrancy;
9798
return this;
9899
}
99100

100-
101101
/**
102102
* Sets the timestamp dependency vulnerability score.
103103
*
104104
* @param timestamp the timestamp dependency score
105+
*
105106
* @return the updated {@code VulnerabilitiesObject} instance
106107
*/
107108
public VulnerabilitiesObject timestamp(int timestamp) {
@@ -113,6 +114,7 @@ public VulnerabilitiesObject timestamp(int timestamp) {
113114
* Sets the tx. origin vulnerability score.
114115
*
115116
* @param txOrigin the tx. origin score
117+
*
116118
* @return the updated {@code VulnerabilitiesObject} instance
117119
*/
118120
public VulnerabilitiesObject txOrigin(int txOrigin) {

0 commit comments

Comments
 (0)