Skip to content

Commit ee0547b

Browse files
committed
SpotlessApply
1 parent 15dacff commit ee0547b

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,6 +1282,8 @@ private Options getOptions() {
12821282
.desc("Path of the folder containing the bytecodes of the cross chain smart contracts")
12831283
.required(false)
12841284
.hasArg(true)
1285+
.build();
1286+
12851287
Option enableTimestampDependencyCheckerOption = Option.builder()
12861288
.longOpt("checker-timestampdependency")
12871289
.desc("Enable timestamp-dependency checker.")

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

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public class MyCache {
2525
private final LRUMap<Integer, Set<Object>> _eventOrderWarnings;
2626
private final LRUMap<Integer, Set<Object>> _uncheckedStateUpdateWarnings;
2727
private final LRUMap<Integer, Set<Object>> _uncheckedExternalInfluenceWarnings;
28+
private final LRUMap<Integer, Set<Object>> _timestampDependencyWarnings;
2829
public final LRUMap<Statement, Set<String>> _eventsExitPoints;
2930

3031
/**
@@ -55,6 +56,7 @@ private MyCache() {
5556
this._uncheckedStateUpdateWarnings = new LRUMap<Integer, Set<Object>>(1000);
5657
this._uncheckedExternalInfluenceWarnings = new LRUMap<Integer, Set<Object>>(1000);
5758
this._eventsExitPoints = new LRUMap<Statement, Set<String>>(2000);
59+
this._timestampDependencyWarnings = new LRUMap<Integer, Set<Object>>(1000);
5860
}
5961

6062
/**
@@ -387,4 +389,38 @@ public int getTxOriginWarnings(Integer key) {
387389
return (_txOriginWarnings.get(key) != null) ? _txOriginWarnings.get(key).size() : 0;
388390
}
389391
}
392+
393+
/**
394+
* Adds a timestamp dependency warning for the specified key. If no warnings
395+
* are associated with the key, a new set is created and the warning is
396+
* added to it. This method is thread-safe.
397+
*
398+
* @param key the key identifying the smart contract or entity for which
399+
* the warning applies
400+
* @param warning the warning object to be added
401+
*/
402+
public void addTimestampDependencyWarning(Integer key, Object warning) {
403+
synchronized (_timestampDependencyWarnings) {
404+
_timestampDependencyWarnings
405+
.computeIfAbsent(key, k -> Collections.synchronizedSet(new HashSet<>()))
406+
.add(warning);
407+
}
408+
}
409+
410+
/**
411+
* Retrieves the number of timestamp dependency warnings associated with the
412+
* specified key. If no warnings are associated with the key, the method
413+
* returns 0. This method is thread-safe.
414+
*
415+
* @param key the key identifying the smart contract or entity whose
416+
* warnings are to be retrieved
417+
*
418+
* @return the number of warnings associated with the key, or 0 if none
419+
* exist
420+
*/
421+
public int getTimestampDependencyWarnings(Integer key) {
422+
synchronized (_timestampDependencyWarnings) {
423+
return (_timestampDependencyWarnings.get(key) != null) ? _timestampDependencyWarnings.get(key).size() : 0;
424+
}
425+
}
390426
}

src/test/java/it/unipr/analysis/cron/semantics/TimestampDependencyAbstractSemanticsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import it.unive.lisa.interprocedural.ModularWorstCaseAnalysis;
1414
import it.unive.lisa.interprocedural.callgraph.RTACallGraph;
1515
import java.io.IOException;
16-
import org.junit.Ignore;
16+
import org.junit.Test;
1717

1818
/**
1919
* JUnit tests for the various control flow structures of the EVM bytecode, such

src/test/java/it/unipr/analysis/cron/semantics/TxOriginAbstractSemanticsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import it.unive.lisa.interprocedural.ModularWorstCaseAnalysis;
1414
import it.unive.lisa.interprocedural.callgraph.RTACallGraph;
1515
import java.io.IOException;
16-
import org.junit.Ignore;
16+
import org.junit.Test;
1717

1818
/**
1919
* JUnit tests for the various control flow structures of the EVM bytecode, such

0 commit comments

Comments
 (0)