@@ -94,27 +94,36 @@ public static Set<Edge> getCrossChainEdgesUsingEventsAndFunctionsEntrypoint(Brid
9494 log .debug ("Events in bridge: {}." , bridge .getEvents ().size ());
9595 log .debug ("Log statement in bridge: {}." , bridge .getXCFG ().getAllLogX ().size ());
9696
97- for (Signature event : bridge .getEvents ()) {
98- for (Signature function : bridge .getFunctions ()) {
99-
100- if (xEVMLiSA .defaultPolicy (event , function )) {
101- functionsUsed .add (function .getFullSignature ());
102- eventUsed .add (event .getFullSignature ());
103-
104- crossChainEdges .addAll (
105- addCrossChainEdges (event .getExitPoints (), function .getEntryPoints ()));
106-
107- MyCache .getInstance ().addMapEventsFunctions (event , function );
108-
109- // Debug print
110- for (Statement e : event .getExitPoints ()) {
111- for (Statement f : function .getEntryPoints ()) {
112- log .debug (
113- "Cross-chain edge added: event {} (name: {}, selector: {}, line: {}) -> function {} (name: {}, selector: {}, line: {})." ,
114- e , event .getFullSignature (), event .getSelector (),
115- ((ProgramCounterLocation ) e .getLocation ()).getSourceCodeLine (),
116- f , function .getFullSignature (), function .getSelector (),
117- ((ProgramCounterLocation ) f .getLocation ()).getSourceCodeLine ());
97+ for (SmartContract contractSource : bridge .getSmartContracts ()) {
98+ for (SmartContract contractDestination : bridge .getSmartContracts ()) {
99+ if (contractSource .equals (contractDestination ))
100+ continue ; // Avoid auto-link
101+
102+ for (Signature event : contractSource .getEventsSignature ()) {
103+ for (Signature function : contractDestination .getFunctionsSignature ()) {
104+
105+ if (xEVMLiSA .defaultPolicy (event , function )) {
106+ functionsUsed .add (function .getFullSignature ());
107+ eventUsed .add (event .getFullSignature ());
108+
109+ crossChainEdges .addAll (
110+ addCrossChainEdges (event .getExitPoints (), function .getEntryPoints ()));
111+
112+ MyCache .getInstance ().addMapEventsFunctions (event , function );
113+
114+ // Debug print
115+ for (Statement e : event .getExitPoints ()) {
116+ for (Statement f : function .getEntryPoints ()) {
117+ log .debug (
118+ "Cross-chain edge added: from contract {} with event {} (name: {}, selector: {}, line: {}) to contract {} with function {} (name: {}, selector: {}, line: {})." ,
119+ contractSource .getName (),
120+ e , event .getFullSignature (), event .getSelector (),
121+ ((ProgramCounterLocation ) e .getLocation ()).getSourceCodeLine (),
122+ contractDestination .getName (),
123+ f , function .getFullSignature (), function .getSelector (),
124+ ((ProgramCounterLocation ) f .getLocation ()).getSourceCodeLine ());
125+ }
126+ }
118127 }
119128 }
120129 }
@@ -131,7 +140,7 @@ public static Set<Edge> getCrossChainEdgesUsingEventsAndFunctionsEntrypoint(Brid
131140 }
132141
133142 /**
134- * Checks if the default policy is to match events and functions by name.
143+ * Matches events and functions by name.
135144 *
136145 * @param event The event signature to compare with the function's name.
137146 * @param function The function signature whose name will be compared with
0 commit comments