cacti icon indicating copy to clipboard operation
cacti copied to clipboard

feat(satp-hermes): create logs in oracle operations

Open AndreAugusto11 opened this issue 7 months ago • 1 comments

We want to introduce logging in the Oracle operations, similar to what we already have in the SATP operations. Each operation should include the following log entries:

  1. Log "init" before starting the operation.
  2. Log "exec" immediately before executing the operation.
  3. After the operation is executed:
  • Log "done" if it was successful.
  • Log "fail" if it failed.

This will help us maintain consistent and traceable execution across both modules.

Example in SATP lockAsset:

async lockAsset(session: SATPSession): Promise<void> {

    this.dbLogger.storeProof({
      sessionID: sessionData.id,
      type: "lock-asset",
      operation: "init",
      data: safeStableStringify(sessionData),
      sequenceNumber: Number(sessionData.lastSequenceNumber),
    });
    try {
      this.Log.info(`exec-${stepTag}`);
      this.dbLogger.storeProof({
        sessionID: sessionData.id,
        type: "lock-asset",
        operation: "exec",
        data: safeStableStringify(sessionData),
        sequenceNumber: Number(sessionData.lastSequenceNumber),
      });

     ...

      const res = await bridge.lockAsset(token);

      this.dbLogger.storeProof({
        sessionID: sessionData.id,
        type: "lock-asset",
        operation: "done",
        data: safeStableStringify(sessionData.lockAssertionClaim.proof),
        sequenceNumber: Number(sessionData.lastSequenceNumber),
      });

    } catch (error) {
      this.dbLogger.storeProof({
        sessionID: sessionData.id,
        type: "lock-asset",
        operation: "fail",
        data: safeStableStringify(sessionData),
        sequenceNumber: Number(sessionData.lastSequenceNumber),
      });
      throw new FailedToProcessError(fnTag, "LockAsset", error);
    }

Steps required:

  1. create dbLogger just like it is being created for SATP, but for the Oracle
  2. insert, in the Oracle Manager, logs before/after every operation

AndreAugusto11 avatar Jun 23 '25 13:06 AndreAugusto11

In review https://github.com/hyperledger-cacti/cacti/pull/4039

RafaelAPB avatar Oct 20 '25 22:10 RafaelAPB