@@ -40,10 +40,12 @@ export function handleLogCrossChainEpochOracle(event: Log): void {
4040 event . transaction . from . toHexString ( )
4141 ] )
4242 }
43+ // Support for Multisend type of transactions ONLY for EventfulDataEdge impl
44+ let payloadId = [ event . transaction . hash . toHexString ( ) , event . logIndex . toString ( ) ] . join ( "-" )
4345 processPayload (
4446 safeExecutionContext != null ? safeExecutionContext . multisigAddress . toHexString ( ) : event . transaction . from . toHexString ( ) ,
4547 data ,
46- event . transaction . hash . toHexString ( ) ,
48+ payloadId ,
4749 event . block . number
4850 ) ;
4951}
@@ -62,19 +64,19 @@ export function handleCrossChainEpochOracle(
6264export function processPayload (
6365 submitter : string ,
6466 payloadBytes : Bytes ,
65- txHash : string ,
67+ payloadId : string ,
6668 blockNumber : BigInt
6769) : void {
6870 log . warning (
69- "Processing payload. Submitter: {}, txHash : {}, blockNumber: {}" ,
70- [ submitter , txHash , blockNumber . toString ( ) ]
71+ "Processing payload. Submitter: {}, payloadId : {}, blockNumber: {}" ,
72+ [ submitter , payloadId , blockNumber . toString ( ) ]
7173 ) ;
7274 // Start the StoreCache
7375 let cache = new StoreCache ( ) ;
7476
7577 // This is the only thing not handled through the store cache since we want all
7678 // Payload entity to persist (to provide context for validity of the payload)
77- let payload = new Payload ( txHash ) ;
79+ let payload = new Payload ( payloadId ) ;
7880 payload . data = payloadBytes ;
7981 payload . submitter = submitter ;
8082 payload . valid = true ;
@@ -99,7 +101,7 @@ export function processPayload(
99101 ] ) ;
100102
101103 // Handle message block
102- let messageBlock = cache . getMessageBlock ( [ txHash , i ] . join ( "-" ) ) ;
104+ let messageBlock = cache . getMessageBlock ( [ payloadId , i ] . join ( "-" ) ) ;
103105 messageBlock . payload = payload . id ;
104106 processMessageBlock ( cache , messageBlock , reader , payload . submitter ) ;
105107 if ( ! reader . ok ) {
@@ -117,8 +119,8 @@ export function processPayload(
117119 payload . save ( ) ;
118120 cache . commitChanges ( ) ;
119121 log . warning (
120- "Processed payload. Submitter: {}, txHash : {}, blockNumber: {}" ,
121- [ submitter , txHash , blockNumber . toString ( ) ]
122+ "Processed payload. Submitter: {}, payloadId : {}, blockNumber: {}" ,
123+ [ submitter , payloadId , blockNumber . toString ( ) ]
122124 ) ;
123125}
124126
@@ -439,6 +441,7 @@ function executeRegisterNetworksMessage(
439441 networks = networksMapped . flat ( ) ;
440442
441443 let numInsertions = decodeU64 ( reader ) as i32 ;
444+ let numReinsertions = 0 ;
442445 if ( ! reader . ok ) {
443446 return ;
444447 }
@@ -453,8 +456,13 @@ function executeRegisterNetworksMessage(
453456 if ( ! cache . isNetworkAlreadyRegistered ( chainId ) ) {
454457 let network = cache . getNetwork ( chainId ) ;
455458 network . alias = PRELOADED_ALIASES . keys ( ) . includes ( network . id ) ? PRELOADED_ALIASES . get ( network . id ) . toString ( ) : ""
456- network . addedAt = message . id ;
457- network . removedAt = null ; // unsetting to make sure that if the network existed before, it's no longer flagged as removed
459+ if ( network . removedAt == null ) {
460+ network . addedAt = message . id ;
461+ } else {
462+ numReinsertions += 1 ;
463+ network . lastUpdatedAt = message . id ;
464+ network . removedAt = null ; // unsetting to make sure that if the network existed before, it's no longer flagged as removed
465+ }
458466 networks . push ( network ) ;
459467 } else {
460468 reader . fail ( "Network {} is already registered." . replace ( "{}" , chainId ) ) ;
@@ -465,6 +473,7 @@ function executeRegisterNetworksMessage(
465473 globalState . activeNetworkCount += numInsertions ;
466474 globalState . activeNetworkCount -= numRemovals ;
467475 globalState . networkCount += numInsertions ;
476+ globalState . networkCount -= numReinsertions ;
468477
469478 commitNetworkChanges ( removedNetworks , networks , globalState , message . id ) ;
470479
@@ -538,6 +547,7 @@ function executeRegisterNetworksAndAliasesMessage(
538547 networks = networksMapped . flat ( ) ;
539548
540549 let numInsertions = decodeU64 ( reader ) as i32 ;
550+ let numReinsertions = 0 ;
541551 if ( ! reader . ok ) {
542552 return ;
543553 }
@@ -552,9 +562,13 @@ function executeRegisterNetworksAndAliasesMessage(
552562
553563 if ( ! cache . isNetworkAlreadyRegistered ( chainId ) ) {
554564 let network = cache . getNetwork ( chainId ) ;
555- network . addedAt = message . id ;
556- network . removedAt = null ; // unsetting to make sure that if the network existed before, it's no longer flagged as removed
557-
565+ if ( network . removedAt == null ) {
566+ network . addedAt = message . id ;
567+ } else {
568+ numReinsertions += 1 ;
569+ network . lastUpdatedAt = message . id ;
570+ network . removedAt = null ; // unsetting to make sure that if the network existed before, it's no longer flagged as removed
571+ }
558572 // Get manifest alias for that CAIP2 id
559573 let alias = decodeString ( reader ) ;
560574 if ( ! reader . ok ) {
@@ -572,6 +586,7 @@ function executeRegisterNetworksAndAliasesMessage(
572586 globalState . activeNetworkCount += numInsertions ;
573587 globalState . activeNetworkCount -= numRemovals ;
574588 globalState . networkCount += numInsertions ;
589+ globalState . networkCount -= numReinsertions ;
575590
576591 commitNetworkChanges ( removedNetworks , networks , globalState , message . id ) ;
577592
0 commit comments