diff --git a/packages/indexer/src/thegraph/ormp.ts b/packages/indexer/src/thegraph/ormp.ts index 58cd61d9..fd98ccdd 100644 --- a/packages/indexer/src/thegraph/ormp.ts +++ b/packages/indexer/src/thegraph/ormp.ts @@ -47,13 +47,16 @@ export class ThegraphIndexOrmp extends GraphCommon { message_to message_gasLimit message_encoded + logIndex oracleAssigned oracleAssignedFee + oracleLogIndex relayerAssigned relayerAssignedFee relayerAssignedProof relayerAssignedParams + relayerLogIndex } } `; diff --git a/packages/indexer/src/types/graph.ts b/packages/indexer/src/types/graph.ts index fb4e9562..aac694ae 100644 --- a/packages/indexer/src/types/graph.ts +++ b/packages/indexer/src/types/graph.ts @@ -94,13 +94,16 @@ export interface OrmpMessageAccepted extends BaseGraphEntity { message_to: string message_encoded: string message_gasLimit: string + logIndex: string oracleAssigned?: string oracleAssignedFee?: string + oracleLogIndex?: string relayerAssigned?: string relayerAssignedFee?: string relayerAssignedProof?: string relayerAssignedParams?: string + relayerLogIndex?: string } export interface OrmpMessageDispatched extends BaseGraphEntity { diff --git a/packages/relay-oracle/src/relay.ts b/packages/relay-oracle/src/relay.ts index c31f6bb1..a9271258 100644 --- a/packages/relay-oracle/src/relay.ts +++ b/packages/relay-oracle/src/relay.ts @@ -198,6 +198,16 @@ export class OracleRelay extends CommonRelay { await super.storage.put(OracleRelay.CK_ORACLE_SIGNED, sourceNextMessageAccepted.message_index); return; } + if ((+sourceNextMessageAccepted.logIndex + 2) != (+(sourceNextMessageAccepted.oracleLogIndex ?? 0))) { + logger.warn( + `unexpected log index (%s, %s)`, + sourceNextMessageAccepted.logIndex, + sourceNextMessageAccepted.oracleLogIndex ?? 0, + super.meta('ormpipe-relay-oracle', ['oracle:sign']), + ); + await super.storage.put(OracleRelay.CK_ORACLE_SIGNED, sourceNextMessageAccepted.message_index); + return; + } const cachedSignedMessageIndex: number | undefined = await super.storage.get(OracleRelay.CK_ORACLE_SIGNED); if (cachedSignedMessageIndex != undefined) { if (+sourceNextMessageAccepted.message_index == cachedSignedMessageIndex) { diff --git a/packages/relay-relayer/src/relay.ts b/packages/relay-relayer/src/relay.ts index 1336d2e1..560bfad3 100644 --- a/packages/relay-relayer/src/relay.ts +++ b/packages/relay-relayer/src/relay.ts @@ -133,6 +133,16 @@ export class RelayerRelay extends CommonRelay { await super.storage.put(RelayerRelay.CK_RELAYER_RELAIED, sourceNextMessageAccepted.message_index); return; } + if ((+sourceNextMessageAccepted.logIndex + 1) != (+(sourceNextMessageAccepted.relayerLogIndex ?? 0))) { + logger.warn( + `unexpected log index (%s, %s)`, + sourceNextMessageAccepted.logIndex, + sourceNextMessageAccepted.relayerLogIndex ?? 0, + super.meta('ormpipe-relay-relayer', ['relayer']), + ); + await super.storage.put(RelayerRelay.CK_RELAYER_RELAIED, sourceNextMessageAccepted.message_index); + return; + } const message: OrmpProtocolMessage = { channel: sourceNextMessageAccepted.message_channel,