Skip to content

Commit 5cec316

Browse files
committed
Refactored event-function matching logic to use defaultPolicy method.
1 parent 3ded57b commit 5cec316

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/main/java/it/unipr/crosschain/xEVMLiSA.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,8 @@ public static Set<Edge> getCrossChainEdgesUsingEventsAndFunctionsEntrypoint(Brid
9696

9797
for (Signature event : bridge.getEvents()) {
9898
for (Signature function : bridge.getFunctions()) {
99-
/*
100-
* We may perform additional checks (e.g., parameter types,
101-
* parameter count, etc.) to link an event to a function, as
102-
* currently we are only linking them based on matching names.
103-
*/
104-
if (event.getName().equalsIgnoreCase(function.getName())) {
99+
100+
if (xEVMLiSA.defaultPolicy(event, function)) {
105101
functionsUsed.add(function.getFullSignature());
106102
eventUsed.add(event.getFullSignature());
107103

@@ -134,6 +130,19 @@ public static Set<Edge> getCrossChainEdgesUsingEventsAndFunctionsEntrypoint(Brid
134130
return crossChainEdges;
135131
}
136132

133+
/**
134+
* Checks if the default policy is to match events and functions by name.
135+
*
136+
* @param event The event signature to compare with the function's name.
137+
* @param function The function signature whose name will be compared with
138+
* the event's name.
139+
*
140+
* @return True if the names match, false otherwise.
141+
*/
142+
public static boolean defaultPolicy(Signature event, Signature function) {
143+
return event.getName().equalsIgnoreCase(function.getName());
144+
}
145+
137146
/**
138147
* Gets cross-chain edges by linking emitting blocks to information blocks
139148
* in different contracts (SmartAxe solution).

0 commit comments

Comments
 (0)